Welcome to Professional ASP.NET - Chris Love's Official Blog Sign in | Join | Help

Chris Love's Official ASP.NET Blog

Chris Love's Helpful tips, tricks and pragmatic development knowledge for the ASP.NET world.
Add to Technorati Favorites


ASP Insider Follow Me On Twitter
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.

Posted: Wednesday, May 07, 2008 3:58 PM

by Chris Love
Filed under: , ,

Comments

Andrew Myhre said:

Nice tip, I was having similar errors like this recently and I wish I'd known about the temp folder then!
# May 8, 2008 5:11 AM

Gurdeep Sira said:

Hi, I get the same error. Will try this! I am adding new files to my solution though. Thanks
# September 29, 2008 4:10 PM

Bimal said:

That worked!! Thank you posting it.
# May 14, 2009 11:28 AM

VG said:

Thank You Sir.
# June 4, 2009 2:17 AM

nano said:

genius!!!!
# July 13, 2009 7:26 PM

Divil said:

You're a gent Love... I simply renamed the temporary folder -incase it messed everythin' up- and it worked perfectly! WOO HOO!!! You're great!
# July 30, 2009 5:19 AM

Jim said:

Thanks, would have never figured it out without your page
# August 21, 2009 9:34 AM

hiro said:

thanks from Japan!
# October 20, 2009 9:17 PM

Melanie said:

Florida here, nicely done Chris!
# October 27, 2009 10:33 AM

Carl said:

Well that saved me a lot of hassle... Thanks :)
# October 31, 2009 7:26 AM

shailendra said:

Thanks it solved my problem.
# November 9, 2009 2:46 AM

Jason said:

it worked for me too! thanks!
# November 22, 2009 10:08 AM

Sandra said:

It worked for me too. Thank you so much for sharing this with us.
# February 9, 2010 4:05 PM

Ropezu said:

It worked!!!! Thanks a lot! ^_^
# April 9, 2010 12:47 PM

Mark said:

Nice one. Worked perfectly. I had the same issue after duplicating some pages so shortcut some development. Thanks for posting.
# April 23, 2010 5:15 AM

Surya Prakash.S,A said:

Oho ! It works. From India... before :-( after :-) Thank you sir...
# April 27, 2010 6:04 AM

Joseph Johnny said:

Thanks a lot Chris...., it worked..
# July 29, 2010 6:58 AM

James said:

Google found you page as top choice and your answer solved my problem on first try (Think I need to go buy a lottery ticket). Thanks for the excellent post!
# August 31, 2010 8:35 PM

Dave said:

Excellent work!!!! Thanks...
# October 1, 2010 9:21 AM

JuanDiego said:

Muchas Gracias!! Funcionó :)
# October 6, 2010 4:10 PM

Paul said:

The gift that keeps on giving. Thanks for the heads up.
# May 17, 2011 5:04 PM

Piyush said:

It works man!!! Thanks !
# April 6, 2012 10:22 AM

EdKadet said:

Whohooo!! Thanks from the netherlands!
# April 18, 2012 9:16 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS