Parser Error. User Control Cannot Be Found.

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.


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: