I am having problems with using RedirectToAction("Index")
in a controller within an Admin
area.
When the Redirect occurs, it hits a breakpoint within the Index method on the controller so I know the redirect is working. However, it fails to find the view.
public ActionResult Index(int? Id)
{
var model = _leadOriginService.GetEditorModel(Id);
return View(mode开发者_C百科l);
}
The exception shows a list of the views it is trying to resolve in the root and not in the area. It seems that it has lost the context of the area it is in.
Any ideas why this doesn't work?
I think you need to call RedirectToAction in another fashion as MVC might not be possible to infer the Area from the way you are calling it, so you need to specify it..
Try
RedirectToAction("Index", "yourController", new {Area="Admin"})
Or
RedirectToAction("Index", new {Area="Admin"})
精彩评论