Nezir
Nezir

Reputation: 6915

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 ?

Upvotes: 0

Views: 1900

Answers (2)

Brian Rizo
Brian Rizo

Reputation: 858

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

Upvotes: 3

Nezir
Nezir

Reputation: 6915

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))};

Upvotes: 0

Related Questions