There is no Global.aspx.cs class in ASP.NET MVC 5 application where I can have the methods Application_Start()
and Application_End()
.
Is there any way to invoke these methods in MVC 5 application?
Asked
Active
Viewed 1,575 times
1
-
Because startup.cs class do not call these methods. – Roman Marusyk Oct 20 '16 at 06:21
-
1Possible duplicate of [Application\_Start not firing?](http://stackoverflow.com/questions/641148/application-start-not-firing) – Roman Marusyk Oct 20 '16 at 06:21
1 Answers
2
You can manually add Global.asax
to your project as mentioned here.
Otherwise, you can use Configuration(IAppBuilder app)
or constructor in your Startup.cs
. Configuration
is called "slightly later" than Application_Start
as mentioned in detail here.

Community
- 1
- 1

Yigitalp Ertem
- 1,901
- 24
- 27
-
I've added and I am getting a Parser Error while running the application – Prashanth Oct 20 '16 at 06:59
-
What's your parser error message? Show it as edit in your question. NB: The Global.asax file should have same namespace as project's namespace. – Tetsuya Yamamoto Oct 20 '16 at 07:54