通过路由删除部分网址 [英] remove part of url with routing
本文介绍了通过路由删除部分网址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好,
i有这个网址
http:// localhost:1549 / Store / Pages / Home.aspx
i想要删除任何页面的网址中的/ Store / Pages和.aspx扩展名
,例如
http:// localhost:1549 / Store / Product / Home.aspx
转换为
http:// localhost:1549 / Product
i尝试此代码
hello,
i have this url
"http://localhost:1549/Store/Pages/Home.aspx"
i want remove "/Store/Pages" and ".aspx" extention in url for any page
such as
"http://localhost:1549/Store/Product/Home.aspx"
convert to
"http://localhost:1549/Product"
i try this code
public class Global : System.Web.HttpApplication
{
void Application_Start(object sender, EventArgs e)
{
RegisterRoutes(RouteTable.Routes);
}
public static void RegisterRoutes(RouteCollection routeCollection)
{
routeCollection.MapPageRoute("",
"/Store/Pages",
"~/.aspx");
}
}
但不工作
请帮帮我
but not work
please help me
推荐答案
查看以下网址:
使用ASP.NET 4.0进行URL路由 [ ^ ]
Have a look at the Below URL :
URL Routing with ASP.NET 4.0[^]
这篇关于通过路由删除部分网址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文