In my project the Global.asax file is removed. I want add a global.asax file to my projet.
But in Add New Item dialog the Global.asax not exist.
Asked
Active
Viewed 5.9k times
34

Samiey Mehdi
- 9,184
- 18
- 49
- 63
3 Answers
91
Just in case you may have missed the item even though it may actually be there for you I'll post this answer.
In Visual Studio 2013
- Open Solution Explorer.
- Right-click on the project.
- Add New Item.
- VB or C#
- Web.
- General.
- Global Application Class.

DreamTeK
- 32,537
- 27
- 112
- 171

Michael Socha
- 1,748
- 1
- 16
- 17
14
- Create an empty new project.
- Go to that folder and copy the Global.asax file.
- Go to your project and in solution explorer paste it on root.
- Open Global.asax file and change namespace match to your namespace.
- In solution explorer right click on Global.asax and pick View Markup and change inherits match to your namespace.

Samiey Mehdi
- 9,184
- 18
- 49
- 63
-
1You should accept Mike Socha's answer. While this works, it's hardly the best solution. – Yatrix Mar 15 '16 at 13:29
-
Yeah, this is the answer that google shows for this question in its preview. Why?? – AlbatrossCafe Aug 05 '16 at 20:38
0
Any problem doing this:
- Create a new empty project and get it from there (drag-and-drop from Windows Explorer to Visual Studio works fine), or
- Add, say aspx page or any item, then rename accordingly (to get the code behind file, add and rename another item); in this case, they'll obviously be empty.

G. Stoynev
- 7,389
- 6
- 38
- 49