這可以做到很容易。您需要在global.asax中更改/添加此代碼。
void registerroute(RouteCollection routes)
{
routes.MapPageRoute("begineercontent", "begineercontent/languages/{Id}", "~/begineercontent.aspx");
}
void Application_Start(object sender, EventArgs e)
{
// Code that runs on application startup
registerroute(RouteTable.Routes);
}
您還需要通過添加
using System.Web.Routing
在你begineercontent.aspx您需要將此代碼添加到頁面加載功能,包括在Global.asax中正確的裝配。關於如何使用路由工作
var Id=(Page.RouteData.Values["Id"] as string);
更的相關詳細的教程可以在這裏找到:
http://msdn.microsoft.com/en-us/library/vstudio/cc668177%28v=vs.100%29.aspx
我照你說的,但沒有在URL @ user3786513無差異 –