Recently I wrote How To Redirect WWW. To The Root of Your Application With IIS. This is a useful if the application is online and is not being updated by a continual deployment. If however, you need to script the changes because your deployment process removes them from the server then you can do this with the Web.config. The Web.config will presist settings that are lost when deploying with msbuild and preserve application logic that still uses sub domains.