Is there a difference between the url rewriting in the web config and using the url routing within the global.asax?
<rewrite>
<rules>
<rule name="Rewrite to article.aspx">
<match url="^article/([0-9]+)/([_0-9a-z-]+)" />
<action type="Rewrite" url="article.aspx?id={R:1}&title={R:2}" />
</rule>
</rules>
</rewrite>
Global.asax
void Application_Start(object sender, EventArgs e)
{
RouteTable.Routes.MapPageRoute("Category", "categories/{name}", "~/ShowPostsByCategory.aspx");
开发者_如何学C RouteTable.Routes.MapPageRoute("BlogPost", "posts/{year}/{month}/{day}/{id}", "~/ShowPost.aspx");
}
URL Rewriting is handled at the IIS level and directs the request at the web server level. ASP.NET Routing handles directing a request to the appropriate handler at the Application level. Look at the link below for more details.
IIS URL Rewriting verses ASP.NET Routing
精彩评论