views:

215

answers:

1

The general problem:

We have urls coming to our IIS web servers formatted like:

http://www.server.com/page.aspx

We are also seeing that urls like this are coming in:

http://www.server.com//page.aspx

We would like to get rid of that extra path character because when the user agent is Internet Explorer, this is resolving as 2 different pages, and thus, downloading the content twice when it should be resolved from a cache.

I am not sure if this is a problem to be solved with something like a url-rewriting module, or if there is a configuration setting.

+1  A: 

I think the problem's with IE and not IIS.

Url Rewriting usually refers to the process of mapping a URL from http://example/shoes/clarkes to http://example/shoes.aspx?maker=clarkes on the server so that the browser doesn't know about it.

What you need to do is Redirect the browser from http://www.server.com//page.aspx to http://www.server.com/page.aspx using a 301 Http response code.

In theory:

As you seem to be using ASP.NET, the most transparent way to do this would be to write a HttpModule that checks for double slashes in the requested URI and does the redirect.

The easiest way to do it is to put some code in Global.ascx.(cs|vb) to check the requested URI on BeginRequest.

Either way, the code to do the checking would be the same.

In Practise:

It might be that IIS or ASP.NET swallows up the double "/" before you get the chance to see it. If it's IIS then you might have to use a proxy in front of IIS. If it's ASP.NET then you might be able to find an ISAPI Extension that will do the job for you.

Other Options

You could either

  • Split the page up so that most of the individual resources can be cached separately from the html content
  • Educate users that they don't need to put the extra slash in.
David Kemp