简体   繁体   English

如何隐藏URL中的扩展名(例如.aspx)?

[英]How to hide Extension ( for eg .aspx ) in the URL?

如何隐藏URL中的扩展名(例如.aspx)?

Are you referring to URL Rewriting? 你指的是URL重写吗?

Tip/Trick: Url Rewriting with ASP.NET 提示/技巧:使用ASP.NET重写URL

URL Rewriting is one good option. URL重写是一个不错的选择。

Another option is to use URL Routing with MVC or Web Forms 另一种选择是使用URL路由与MVCWeb窗体

I think ideally you'd want to use ASP.NET MVC. 我认为理想情况下你想使用ASP.NET MVC。

If you use MVC as your website paradigm, the way that arguments are passed to the Model is through the actual addressing of the URL. 如果您使用MVC作为您的网站范例,那么参数传递给模型的方式是通过URL的实际寻址。

So you can then use address suffixes like: /do/useraccount 因此,您可以使用地址后缀,例如:/ do / useraccount

This is also what is being pushed by Microsoft and the ideas invested in ASP.NET 4.0 as they have included tools for making Model View Controller easier to implement. 这也是微软推动的以及投入ASP.NET 4.0的想法,因为它们包含了使模型视图控制器更易于实现的工具。

Your Website < .NET 3.5 SP1 :-使用第三方URL重写(例如Intelligencia URL重写器) Your Website >= .NET 3.5 SP1 :-使用内置URL路由(例如“MapPageRoute”)

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

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