简体   繁体   English

如何在asp.net中使用global.asax隐藏aspx扩展名(URL重写)

[英]how to hide aspx extension(URL rewriting) using global.asax in asp.net

I am working on URL rewriting using global.asax in asp.net 3.5, 我正在使用ASP.NET 3.5中的global.asax进行URL重写,

URL:http://localhost:65278/URL_EG2/SubFolder/Home.aspx 网址:http:// localhost:65278 / URL_EG2 / SubFolder / Home.aspx

I want it to rewrite as: http://localhost:65278/Home 我希望它重写为: http:// localhost:65278 / Home

How to acheive this? 如何做到这一点? Can anyone give me simple EG? 谁能给我简单的EG?

I assume you are using ASP.NET web forms. 我假设您正在使用ASP.NET Web表单。

If you use Routing for Web Forms then you don't need to have extensions on the url. 如果您使用“ Web表单路由”,则不需要在URL上具有扩展名。 You can have the same routing goodness experienced by the MVC apps in your web forms applicaiton as well. 您也可以在Web表单应用程序中获得与MVC应用程序相同的路由优势。

Check here to learn more about Routing for ASP.NET Web Forms 单击此处以了解有关ASP.NET Web窗体路由的更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM