Type 'ASP.global_asax' is not defined.

I am honestly not sure how I created this error, but I know this I did not find much out there on how to solve the issue. I think part of the reason this occurred is I was adding existing pages from another site to reuse in a new web site. But I have not conclusive evidence to isolate this as the source of the exception.

Since I did not find anything of help to solve the issue I resorted to a tried and true trick, deleting the temporary files created by Visual Studio. This requires you first close Visual Studio, because Visual Studio will lock these temporary files while you are actually working. The temporary files are located in the %WINDOWS%\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files folder. Here you will see another folder for each of your web sites. Under that you will find a random hodge podge of child folders I will not waste our time examining, just just looks like a hacker got a hold of your open FTP server (trust me :).

After Visual Studio has been closed, simple select the folder for the site, I honestly just delete them all to be on the safe side, and delete them. I mean just hard delete them and do not even go to the recycling bin (Shoft+Delete).

Now reopen your site and build and execute it. If that was your only exception it seems to be resolved at this point. At least it was for me. I hope this helps you out, feel free to leave a comment if you have another way to solve this issue. I use this technique to solve many befuddling issues I have in everyday ASP.NET development.

Share This Article With Your Friends!

Googles Ads Facebook Pixel Bing Pixel LinkedIn Pixel