I have created a C#-> Asp.Net Empty Web Application (Framework 4.0). I want to add few line of code in Global.asax on Application_Error section. But unfortuantely global.asax file is missing. How can i add that file? My visual studio version is 2012
The Global. asax, also known as the ASP.NET application file, is located in the root directory of an ASP.NET application. This file contains code that is executed in response to application-level and session-level events raised by ASP.NET or by HTTP modules.
An ASP.NET site can run without the global.
How to add global. asax file: Select Website >>Add New Item (or Project >> Add New Item if you're using the Visual Studio web project model) and choose the Global Application Class template. After you have added the global.
asax. So answers: 1) No, not mandatory.
You can add a new file to the project of type Global Application Class
File -> New -> File -> Global Application Class
Alternately, you can create a new temporary project, which should generate a Global.asax file. Then just copy/paste that into your project.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With