Archive for the ‘IIS’ Category

Parser Error. User Control Cannot Be Found.

February 3, 2011

Hello Good Morning and Welcome.

Lovers of the ubiquitous .NET Parser Error are in for a real treat today. Fans of misogynistic Peruvian Biochemists will have to go elsewhere.

The issue was that my DogBreath UserControl could not be found at the path: ~/AU/Controls/DogBreath/DogBreath.ascx, which is the path I had put into the Register directive on the aspx page: correctly I might add.

There is in fact a DogBreath control at that path but the problem was there is also a Virtual Directory at AU, one level below the Virtual Directory for the website, exactly where I was expecting a Physical AU directory.

The Home (Physical) Directory of that virtual AU directory is C:\Inetpub\gutsache\staging. The physical (home) directory of my website was C:\Inetpub\Animals. So, whereas the expected path to my DogBreath control was C:\Inetpub\Animals\AU\Controls\DogBreath\DogBreath.ascx, the presence of that Virtual AU directory caused the parser to resolve to: C:\Inetpub\gutsache\staging\Controls\DogBreath\DogBreath.ascx.

No DogBreath control there, so hence the Parser Error. Lovely innit, fans ?

The quick workaround was to copy the controls to the correct place under the Virtual AU directory.

The real solution was to immerse a live stoat in a quart of boiling mercury rename the virtual AU directory to something else, anything else except AU, so it wouldn’t interfere with the Parser’s path resolution.

And if you didn’t quite catch that, if you get a Parser Error relating to a UserControl path not found, make sure that the top-level physical directory in your path isn’t also mapped to a Virtual Directory in IIS.

So that’s all we have time for here at Fun With Parsers. Until next week, then: Have a mercurified stoat on me.


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

June 29, 2010


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.