0

I have an ASP.Net MVC 3 Website hosted on a shared Windows hosting package. I wish for my site to automatically add a 'www' prefix to all my site pages when the user does not type it in, ie, mytestpage.com redirects to www.mytestpage.com.

I have browsed extensively through Stackoverflow and other Internet sites to find a solution to this, but to no avail. The solutions given are to either configure IIS itself, however, I do not have access to IIS as I am using a shared hosting package.

Others have said to add the prefix via the web config file IIS7 URL Rewrite - Add "www" prefix however this seems only to work with IIS 7.

Is there any other way I can achieve this?

Your help is greatly appreciated.

Thanks.

Community
  • 1
  • 1
tcode
  • 5,055
  • 19
  • 65
  • 124

1 Answers1

-1

On my solutions I do a check on Application Start whether the request has www or not. If not, I redirect to www.

And all my links are relative, of course.

jln-dk
  • 294
  • 1
  • 2
  • 11