IE9 RC fixed the “Internet Explorer cannot display the webpage” error when running an ASP.NET application in Visual Studio

One of the obstacles ASP.NET developers faced in using the Internet Explorer 9 Beta was the dreaded “Internet Explorer cannot display the webpage” error when running an ASP.NET application in Visual Studio.

IE9 Beta - Cannot Display Page Error with ASP.NET Development Server

In the bug information on Connect (issue 601047), Eric Lawrence said that the problem was due to “caused by failure to failover from IPv6 to IPv4 when the connection is local.”

Robert MacLean gives some more information as what was going wrong:

“The problem is Windows, especially since it assumes IPv6 is better than IPv4. Note […] that when you ping localhost you get an IPv6 address. So what appears to be happening is when IE9 tries to go to localhost it uses IPv6, and the ASP.NET Development Server is IPv4 only and so nothing loads and we get the error.”

The Simple Fix - Install IE 9 RC

Internet Explorer 9 RC fixes this bug, so if you had tried IE 9 Beta and stopped using it due to problems with ASP.NET development, install the RC.

The Workaround in IE 9 Beta

If you're stuck on IE 9 Beta for some reason, you can follow Robert's workaround, which involves a one character edit to your hosts file. I've been using it for months, and it works great.

  1. Open notepad (running as administrator) and edit the hosts file (found in %systemroot%\system32\drivers\etc)
  2. Remove the # comment character before the line starting with
  3. Save the file - if you have problems saving, it's probably because you weren't running as administrator

When you're done, your hosts file will end with the following lines (assuming you were using a default hosts file setup beforehand):

# localhost name resolution is handled within DNS itself.       localhost
#    ::1             localhost

Note: more information on editing your hosts file here.

This causes Windows to default to IPv4 when resolving localhost, which will point to, which is right where Cassini - I mean the ASP.NET Web Development Server - is waiting for it.


Comments have been disabled for this content.