如何.NET网站隐藏自己的文件.aspx扩展? [英] How do .NET sites hide .aspx extension of their files?
问题描述
我是pretty确保stackoverflow.com与ASP.NET创建的,但无论在哪里我点击我看到在地址栏中没有.aspx扩展名。
它是怎么做的,是有特定的原因?
I'm pretty sure stackoverflow.com is created with ASP.NET, but no matter where I click I see no .aspx extension in the address bar. How it is done and is there a particular reason for this?
推荐答案
在计算器的情况下,他们使用ASP.NET MVC,而不是ASP.NET Web表单。随着网络的形式,该URL指向您的磁盘上的文件,而MVC指向控制器操作。如果您使用的WebForms,您想使用URL重写。斯科特格思里有一个<一个href=\"http://weblogs.asp.net/scottgu/archive/2007/02/26/tip-trick-url-rewriting-with-asp-net.aspx\">good做URL重写文章。
In the case of stackoverflow, they use ASP.NET MVC rather than ASP.NET web forms. With web forms, the url is pointing to a file on your disk, while MVC is pointing to a controller action. If you're using webforms, you'd want to use URL rewriting. Scott Guthrie has a good article on doing URL rewriting.
这篇关于如何.NET网站隐藏自己的文件.aspx扩展?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!