Global.asax file is missing on my Asp.Net Empty Web application project
48,497
Solution 1
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.
Solution 2
You can also add it from project i.e. right click the project and add new item there you can find or search for Global Application Class template and add it.It's done.
Related videos on Youtube
Author by
Selva
Updated on June 19, 2020Comments
-
Selva almost 4 years
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
-
Selva over 9 yearsI just followed File -> New -> File -> Global Application Class and it created Global1.asax file then i have choosed "Moved Global1.asax to my project" option in file menu. But still i am not getting glboal1.asax.cs file?
-
trnelson over 9 years@Selva did you already have a Global.asax file? Your question is worded in such a way that it seems that's what you need. Or do you just need the .cs file?
-
Auguste over 9 yearsHmmmm! The Global.asax seems to be already on your project. I would close Visual Studio and reopen it. When adding Global.asax, it should shows at Global.asax, not Global1.asax.
-
Hussein Khalil over 7 yearsThis Worked For me
-
puddleglum about 7 yearsI noticed in VS2015 that you will not see the Global Application Class option if you already have a global.asax when choosing 'Add New Item > C# > Web'. I had the aspx w/o the .cs. I had to first delete the aspx, then re-add to get the .cs
-
Kevin Scharnhorst about 5 yearsAs user @puddleglum mentions in another comment, the template is only displayed if there is not already a Global.asax file. If you don't see the template you do in fact have a Global.asax, but you have overlooked it.