Preferred way to install and run code in Application_Start

What is the preferred way to hook and run some code in Application_Start and Application_Endrequest without having to paste the code into the MvcApplication class?

Maybe there is an event, attribute, or something that I can connect in asp.net 4?

+3
source share
2 answers

This is not a valid statement that "allows you to include code to run before compiling the application."

The WebActivator classes you create are collected in the assembly, but they allow you to fire 3 events at runtime:

1.) PreApplicationStartMethod 2.) PostApplicationSTartMethod 3.) ApplicationShutdownMethod

:

"WebActivator - NuGet, -. , global.asax ".

WebActivator , ( ) .

, Unity, Combres 51DegreesMobi , MVC3. Global.asax.

.NET 4 PreApplicationStartMethod, WebActivator.PreStartupMethod, App-Start, .NET 4, , .

+2

Source: https://habr.com/ru/post/1775303/


All Articles