Matt
Matt

Reputation: 631

How do you tell when IIS is applying the "Default Page" setting in ASP.NET (C#)

I'm attempting to issue a 301 redirect when a user requests http://www.mysite.com/Default.aspx to http://www.mysite.com/

The issue I'm having is that every property I can find within Request (Request.Url, Request.RawUrl, etc) is identical for those two requests.

Edit for further clarification: This is on a shared web host, I can't install ISAPI extensions.

One more edit. Apparently the first tech support guy I talked to at the host didn't know what he was talking about, they have ISAPI rewrite installed.

Upvotes: 2

Views: 261

Answers (3)

Zhaph - Ben Duguid
Zhaph - Ben Duguid

Reputation: 26956

Whilst a lot of people cite SEO as the reason for wanting to do this, I'd just like to make a minor observation:

Search for the word "Welcome" on my site

This word appears on the homepage (default.aspx), and in a blog post. At the moment I'm seeing three results for this search:

Search results

The middle one is my homepage, and you'll note that it's only listed once - yet you can easily visit, and stay on /default.aspx if you browse to it (and indeed, the navigation on the site links to /Default.aspx).

If anything it's more of an issue with reporting, as google analytics for example sees /default.aspx and /Default.aspx as different pages (but again, the search results are ignoring casing on a windows server):

Analytics repeats

So, all I'm saying is that search engines are often brighter than SEO consultants give them credit for...

A bigger problem for my site is the fact that I have three domain names pointing at it, and still haven't gotten around to putting a redirect inplace for the other ones.

Upvotes: 0

dommer
dommer

Reputation: 19820

Steve Wortham's Blog describes how he addressed the same issue.

He used Ionic's free Isapi Rewrite Filter

Upvotes: 2

autonomatt
autonomatt

Reputation: 4433

Just use a url rewriting ISAPI filter. It's painless. This page on Scott Gu's blog contains pretty much all the info you need.

Upvotes: 1

Related Questions