2013-04-08 88 views
0

我有一個名爲User的區域。在那個區域下,我有一個叫做索引的視圖。我無法找到解決方案的MVC路由問題

區註冊,只有一個途徑:

public override void RegisterArea(AreaRegistrationContext context) 
{ 
context.MapRoute(
       "0", 
       "user/signup", 
       new { action = "Index", controller = "Signup" }, 
       new string[] { "Company.Web.Areas.User.Controllers" } 
      ); 
} 

路徑控制器:

Areas\User\Controllers\SignupController.cs 

路徑圖:

Areas\User\Views\Signup\Index.cshtml 

這是我正在試圖生成URL中標題超鏈接:

<a href="@Url.Action("Index", "Signup", new { area = "User", returnUrl=ViewContext.HttpContext.Request.Url.PathAndQuery })">Signup</a> 

這是我得到的網址: http://www.myserver.com/user/signup?returnUrl=home/main

的URL看起來正確,路由只有一個途徑。

但是,當我點擊該網址時說:無法找到資源。用戶/註冊

我錯過了什麼?

回答

0

嘗試

context.MapRoute(
      "signup", 
      "{controller}/{action}", // URL with parameters 
      new { controller = "Signup", action = "Index" } // Parameter defaults 
     ); 

這應該映射到註冊控制器和索引操作

相關問題