Force a website to use WWW using IIS

Some times you need to redirect all request to to . To achieve this you can write code to see if request is for and redirect to . We can also achieve this using just IIS (i think it will be faster than Code base solution) taking advantage of host headers. Add hostheader to your website (see how to this in this link ) . Now create another new website with exact same settings as your first website exept host header value it should be Now right click your new website in IIS select properites and goto Home directory tab. select "A redirection to URL" radio button, in the "Redirect to" text box enter . See the screen shot below for more details