简体   繁体   中英

Asp.net 2.0 Hide Default.aspx from Url

I have one issue with my site. I need to hide Default.aspx from Url. My web site project uses urlrewriter net and I tried using it to make this but no success.

I read lot of articles on net how to do this but nothings work.

Does this is only possible to set on IIS ?

I wont all ways to have www.test.com instead of www.test.com/default.aspx

Please for best solution ?

If you're using iis 7 or above, this might be a way of going about it.

The Microsoft URL Rewrite Module 2.0 for IIS 7 and above enables IIS administrators to create powerful customized rules to map request URLs to friendly URLs that are easier for users to remember and easier for search engines to find. You can use the URL Rewrite module to perform URL manipulation tasks.

http://www.iis.net/learn/extensions/url-rewrite-module/using-the-url-rewrite-module

And heres a link to see the module in action. http://www.iis.net/learn/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module

After reading tons of articles this is solution for my problem.. setting this javascript onto masterpage

var testremove = location.href.toLowerCase().indexOf("default.aspx");
if (testremove != -1) {location.replace(location.href.substring(0,testremove))};

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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