tags:

views:

428

answers:

4

What is the purpose of the global.asax in Asp.net?

+1  A: 

Some application level events you can declared ..

For Example , you want to execute something while All session ends for that you can you global.asax file straight way .. There is a event Session_End

karthik
+1  A: 

If you mean global.asax, then open it up and look inside. What do you see there?

John Saunders
Well, did you? It's not too tough to open in Notepad.
John Saunders
That was me that down voted the answer, not the poster, as answering the question with a question isn't really that helpful.
Tom Anderson
@Tom: with questions like these, it's obvious the user did absolutely no research on their own. Simple questions like these can be answered by Google, and for the most part, should never reach a site like stack overflow.
Chris
@Tom: I'm sorry, but unless the poster was crippled, he doesn't need my help to open the file in Notepad. If he had opened it and had a question about what was inside of it, then I would have answered. don't know if the OP is one of them, but we seem to be getting people who will ask a badly-worded question on SO without thinking about it just for a few seconds, and before they even Google.
John Saunders
+12  A: 

The Global.asax file, also known as the ASP.NET application file, is an optional file that contains code for responding to application-level and session-level events raised by ASP.NET or by HTTP modules. The Global.asax file resides in the root directory of an ASP.NET application. At run time, Global.asax is parsed and compiled into a dynamically generated .NET Framework class derived from the HttpApplication base class. ASP.NET is configured so that any direct URL request for the Global.asax file is automatically rejected; external users cannot download or view the code in it. The Global.asax file is optional. You create it only if you want to handle application or session events.

(MSDN, accessed on 07/06/2009 http://msdn.microsoft.com/en-us/library/2027ewzw.aspx)

SQL Baba
+1 for not directly copy-pasting
tzup
@tzup ha ha.. thanks.
SQL Baba
+1 for the same reason like tzup
Ikaso
+3  A: 

Assuming you mean global.asax, here's some info.

Si