我使用的是asp.net mvc,但無法訪問我的頁面,得到了錯誤。asp.net-mvc的ROUTE:無法找到資源
頁面的URL:
本地主機:2334/RAWDATA/EiphoneNews
視圖文件的位置:
根目錄/查看/ RAWDATA/TNews/Index.cshtml
我路線:
public static void RegisterGlobalFilters(GlobalFilterCollection filters)
{
filters.Add(new HandleErrorAttribute());
}
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Home", action = "Index", id = UrlParameter.Optional } // Parameter defaults
);
routes.MapRoute(
"RawData", // Route name
"RawData/{controller}/{action}/{id}", // URL with parameters
new { controller = "EiphoneNews", action = "Index", id = UrlParameter.Optional }, // Parameter defaults
new string[] { "News.Controllers.RawData" }
);
}
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
}
我的控制器:
namespace News.Controllers.RawData
{
public class EiphoneNewsController : AuthorizedController
{
//
// GET: /EiphoneNews/
public ActionResult Index(int pagenum = 0, int pagesize = 20, string queryString = null)
{...}
}
}
開關默認和RAWDATA MapRoutes。現在它首先檢查Default。 – Wim 2012-08-17 06:56:56