私はユーザーエリアを持っており、この中に以下を登録しています:
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が正しいコントローラーとアクションに移動していることを示しているように見えるので、私は非常に混乱していますが、それを使用せずにブレークポイントを設定すると、コントローラーのアクションに移動していないようです。