更新时间:2023-10-17 19:49:58
您可以使用太与ASP.NET的WebForms路由。
You can use routing with ASP.NET WebForms too.
的步骤是:
在应用程序启动添加路由(或路由)。
Add the route (or routes) at application start.
//In Global.asax
void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.MapPageRoute("My Routename", "{*name}", "~/Article.aspx");
}
创建Article.aspx作为一个正常的表单
Create the Article.aspx as a normal webform
在code为Article.aspx,您可以访问这样的URL路径:
In the code for Article.aspx, you can access the url path like this:
public void Page_Load(object sender, EventArgs e)
{
var thePath = RouteData.Values["name"];
// Lookup the path in the database...
}