(IIS 7 or greater required)
from http://www.codeproject.com/Articles/87759/Redirecting-to-WWW-on-ASP-NET-and-IIS
(Similar to above solution, but not requiring you to add your own domain name.)
<configuration>
<system.webServer>
<rewrite>
<rules>
<clear />
<rule name="WWW Rewrite" enabled="true">
<match url="(.*)" />
<conditions>
<add input="{HTTP_HOST}" negate="true"
pattern="^www\.([.a-zA-Z0-9]+)$" />
</conditions>
<action type="Redirect" url="http://www.{HTTP_HOST}/{R:0}"
appendQueryString="true" redirectType="Permanent" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
Note that you will most likely see squiggly lines under the tag with a message that the tag is invalid. I got this message but, in fact, it worked just fine.
If you want the intellisense to work, you can try this update here...
http://ruslany.net/2009/08/visual-studio-xml-intellisense-for-url-rewrite-1-1/
More information about httpRedirect can be found here...
http://www.iis.net/configreference/system.webserver/httpredirect