我需要正確的Global.asax設置才能使我的動態數據站點在ASP.NET MVC項目下運行。路由目前似乎是我的問題。ASP.NET MVC應用程序路由不適用於動態數據WebForm頁面
這裏是我的Global.asax:
public static void RegisterRoutes(RouteCollection routes)
{
routes.IgnoreRoute("{resource}.axd/{*pathInfo}");
MetaModel model = new MetaModel();
model.RegisterContext(typeof(Models.DBDataContext), new ContextConfiguration() { ScaffoldAllTables = true });
routes.Add(new DynamicDataRoute("DD/{table}/{action}.aspx") {
Constraints = new RouteValueDictionary(new { action = "List|Details|Edit|Insert" }),
Model = model
});
routes.MapRoute(
"Assignment",
"Assignment/{action}/{page}",
new { controller = "Assignment", action = "Index", page = "" });
routes.MapRoute(
"Default", // Route name
"{controller}/{action}/{id}", // URL with parameters
new { controller = "Admin", action = "Index", id = "" }); // Parameter defaults
}
鏈接,我想要使用的是:
我收到以下信息:
'/'應用程序中的服務器錯誤。無法找到 資源。說明: HTTP 404.您正在查找的資源 (或其某個依賴關係)可能已被刪除,其名稱已更改爲 ,或暫時無法訪問 。請檢查URL後的 ,並確保它是 拼寫正確。
請求的URL: /DD/Work_Phases/ListDetails.aspx
我試過,因爲應用程序內的文件夾DynamicData更換DD是DynamicData且產生完全相同的結果。
你試圖匹配哪條路線? – 2009-07-31 22:42:42
@Adrian:我試圖去DD/Work_Phase/ListDetails.aspx但頁面不會出現。 – RSolberg 2009-07-31 22:43:31