开发者

How to hide/change asp.net page extension from the viewer?

开发者 https://www.devze.com 2022-12-13 12:20 出处:网络
How to hide/change asp.net page extension from the viewer at the client-side? I.e. while accessing a page w开发者_JAVA技巧ww.xyz.com/Dir/MyPage.aspx, the viewer would only see www.xyz.com/Dir/MyPage.

How to hide/change asp.net page extension from the viewer at the client-side?

I.e. while accessing a page w开发者_JAVA技巧ww.xyz.com/Dir/MyPage.aspx, the viewer would only see www.xyz.com/Dir/MyPage.html or www.xyz.com/Dir/MyPage.


You need to look into using URL rewriting. If you are using IIS 7 then you can use Microsoft URL rewrite. I also use the URL rewrite software ISAPI Rewrite. Basically you'll end up creating rewrite rules to append the .aspx extension to the IIS page requests which have no extension. Then all your links created in your code should be created without the .aspx extension.

I realize this response is a bit abbreviated, but I suggest you start learning about URL rewriting.

EDIT: I'm not sure if you'll get this, but I created a screencast and posted it to my blog which covers the basic idea of how to hide the page extension for ASP.NET. I hope it helps :-)


You can use the routing built into MVC. It's not in any way required to only be used with the MVC Framework, and is quite agnostic.

0

精彩评论

暂无评论...
验证码 换一张
取 消