I have a User area and inside this I have the following registered:
context.MapRoute("DefaultRedirect",
"",
new { controller = "Account", action = "Login" }
);
When I use routeDebug it tells me that when I connect to my site http://www.xxx.com then it will try to call
area = User, controller = Account, action = Login
When I connect directly using: http://www.xxx.com/User/Account/Login my login page appears.
When I don’t use routeDebug and connect to my site http://www.xxx.com then I get an error message saying:
Server Error in '/' Application.
The resource cannot be found.
Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable. Please review the following URL and make sure that it is spelled correctly.
Requested URL: /
Here’s my controller action method:
public class AccountController : Controller
{
//
// GET: /Account/Login
[AllowAnonymous]
public ActionResult Login()
{
ViewBag.ReturnUrl = "xx";
return View("~/Areas/User/Views/Account/Login.cshtml");
}
I am very confused as routeDebug appears to show I am going to the right controller and action however when I don’t use that and place a breakpoint it does not seem to go to the controller action.
if this controller is inside the same area i think you just can use
Either way if you have only the views on a different areas you can use