我想在我的表單中實現url路由。我已經做了部分。你能幫我把路由設置到初始頁面或索引頁面嗎?在我的路線圖類,我寫如下如何在asp.net webforms中設置默認頁面url路由
routes.MapPageRoute("Index","","~/Index.aspx");
,我設置爲Index.aspx的作爲設定爲起始頁並運行它。但網址仍然是Index.aspx。
在默認頁面的MVC中,我們將編寫如下的一組行。
routes.MapRoute(
name: "Default",
url: "{controller}/{action}/{id}",
defaults: new { controller = "Student", action = "Index", id = UrlParameter.Optional }
);
在Webforms中有沒有像這樣的技術?
看看ScottGu的一篇很好的文章[這裏](http://weblogs.asp.net/scottgu/url-routing-with-asp-net-4 -web-forms-vs-2010-and-net-4-0-series) – Yogi
@gkrishy路由是Ro的對象uteCollection –
@LibinCJacob如果你不使用MVC,你可能無法做到,因爲在webforms中,每個View/Page的後面都有代碼,不像控制器(在MVC中) – manish