我有一个用户区域,在其中我注册了以下内容:
context.MapRoute("DefaultRedirect",
"",
new { controller = "Account", action = "Login" }
);
当我使用 routeDebug 它告诉我,当我连接到我的网站 www.xxx.com 时,它会尝试调用
area = User, controller = Account, action = Login
当我使用以下方式直接连接时:www.xxx.com/User/Account/Login 会出现我的登录页面。
当我不使用 routeDebug 并连接到我的网站 www.xxx.com 时,我会收到一条错误消息:
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: /
这是我的控制器操作方法:
public class AccountController : Controller
{
//
// GET: /Account/Login
[AllowAnonymous]
public ActionResult Login()
{
ViewBag.ReturnUrl = "xx";
return View("~/Areas/User/Views/Account/Login.cshtml");
}
我很困惑,因为 routeDebug 似乎表明我要使用正确的控制器和操作,但是当我不使用它并放置断点时,它似乎并没有转到控制器操作。