Browsing .html/.htm File in IIS Renders a Blank Page in the Browser


You are running ASP.NET 2.0 and IIS 6.0

You have a .html file in a Virtual Directory in IIS, you open up that Virtual Directory in IIS, right-click on the .html file and click “Browse”. The file comes up in the browser blank. No HTML is rendered. The .html file extension is configured in IIS to use aspnet_isapi.dll.

An hour has passed and you have chewed your arm off at the elbow in frustration and the emergency sacrificial ferrett is looking nervous. Powerful repetitive thuds from your headdesking are waking the neighbours. Your children are crying and saying ‘What’s wrong with Daddy ??”. Molten coils of incandescent rage… (Editor: Enough of that, KThxBi)

Other Symptoms
When you browse the .html file from a remote computer you get “Page cannot be displayed” error message. But aspx files render perfectly. This exponentially magnifies your bowel-twisting madness, screaming fruitbats..(Editor: I SAID ENUFF!!)

What You Need
What you need is a .NET StaticFileHandler in your web.config httpHandler section. i.e.
add path=”*.html” verb=”*” type=”System.Web.StaticFileHandler” /

Here’s the reason direct from the Microsoft Support web site:

Microsoft ASP.NET 2.0 delegates static file processing back to the IIS 6.0 static file handler through the Execute URL server support function. This behavior lets you to run ASP.NET authentication and authorization modules while serving static content.

Because ASP.NET 2.0 delegates static file processing back to IIS 6.0, any explicit script mapping that maps a file name extension to ASP.NET must have a corresponding mapping in ASP.NET. If the corresponding mapping in ASP.NET does not exist, ASP.NET passes the file processing back to IIS. IIS detects this recursion and then sends an empty HTTP response.

Here’s the full article:

You receive a “Page cannot be displayed” error message when you use an ASP.NET application to open an .htm file or another static file that is hosted in IIS 6.0

Now get yourself bandaged up and apologize to the kids. It’s just another day on Earth.


Tags: , ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: