在ASP.NET Web表单中删除URL末尾的.aspx [英] Remove .aspx at the end of url in ASP.NET web form

查看:185
本文介绍了在ASP.NET Web表单中删除URL末尾的.aspx的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的asp.net网络表单网站中,我想在网址末尾删除.aspx。因为我在global.cs中使用以下代码但是没有工作PLZ帮助。





void RegisterRoutes(RouteCollection routes)

{

routes.MapPageRoute(All Product,Products / All,〜/ AllProduct.aspx);

routes.MapPageRoute (选定产品,产品/选定/ {名称},〜/ ParticularProduct.aspx);

}



我尝试过:



无效RegisterRoutes(RouteCollection路线)

{

routes.MapPageRoute(登录,登录,〜/ Login.aspx);



}

In my asp.net web-form web-site I want to remove .aspx at the end of url. for that i use following code in global.cs but is is not working plz help.


void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("All Product", "Products/All", "~/AllProduct.aspx");
routes.MapPageRoute("Selected Product", "Products/Selected/{name}", "~/ParticularProduct.aspx");
}

What I have tried:

void RegisterRoutes(RouteCollection routes)
{
routes.MapPageRoute("Login", "Login", "~/Login.aspx");

}

推荐答案

阅读Hanselman对此所说的话......

ASP简介。 NET FriendlyUrls - 更清晰的URL,更简单的路由和ASP.NET Web窗体的移动视图 - Scott Hanselman [ ^ ]
Read what Hanselman had to say about it...
Introducing ASP.NET FriendlyUrls - cleaner URLs, easier Routing, and Mobile Views for ASP.NET Web Forms - Scott Hanselman[^]


这篇关于在ASP.NET Web表单中删除URL末尾的.aspx的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆