I came across an annoying thing on Vista today when trying to run a Website using http://localhost:#####/WebSite, ##### being the dynamically allocated port for running the website locally via Visual Studio 2005. I discovered that it was the hosts file that was causing the issue. I was getting an error such as "Internet Explorer cannot display the webpage".

To fix this problem you'll need to do the following things.

Access your HOSTS file using the following instructions.
http://www.dafran.net/Blog/post/Changing-your-hosts-file-in-Vista.aspx

By default the Vista HOSTS file contains a single Line.
::1             localhost

This is a IPv6 entry and you more than likely need a conventional IPv4 entry, as show here.
127.0.0.1    localhost

There are a few ways to resolve this problem.
1. Remove the ::1  localhost line
2. Place a # (hash or pound) symbol in front of the ::1 Localhost line so it reads #::1  localhost. This will effectively comment it out so that the default 127.0.0.1 will be used.
3. You can also "add" a new line  that reads 127.0.0.1  localhost

Combinations that work
-----------------------------------
<nothing at all>
-----------------------------------
::1  localhost
127.0.0.1  localhost
-----------------------------------
#::1  localhost
-----------------------------------
#::1  localhost
127.0.0.1  localhost
-----------------------------------
127.0.0.1  localhost

 For more information on HOST files see http://en.wikipedia.org/wiki/Localhost


Dave Stuart

The Life and Times of a .NET developer and all the challenges that come with it...