Questions tagged [application-start]

Application_Start method called by ASP.NET once for the lifetime of the application domain, not for each HttpApplication instance. It's called when the first resource (such as a page) in an ASP.NET application is requested.

During asp.net application life cycle, the application raises events that you can handle and calls particular methods that you can override. To handle application events or methods, you can create a file named Global.asax in the root directory of your application.

If you create a Global.asax file, ASP.NET compiles it into a class derived from the HttpApplication class, and then uses the derived class to represent the application.

An instance of HttpApplication processes only one request at a time. This simplifies application event handling because you do not need to lock non-static members in the application class when you access them. This also allows you to store request-specific data in non-static members of the application class. For example, you can define a property in the Global.asax file and assign it a request-specific value.

ASP.NET automatically binds application events to handlers in the Global.asax file using the naming convention Application_event, such as Application_BeginRequest. This is similar to the way that ASP.NET page methods are automatically bound to events, such as the page's Page_Load event. For details, see ASP.NET Page Life Cycle Overview.

The Application_Start and Application_End methods are special methods that do not represent HttpApplication events. ASP.NET calls them once for the lifetime of the application domain, not for each HttpApplication instance.

The following table lists some of the events and methods that are used during the application life cycle. There are many more events than those listed, but they are not commonly used.

http://msdn.microsoft.com/en-us/library/ms178473.aspx

89 questions
0
votes
0 answers

ASP.NET Application lifecycle - Application_Start

Having a read of the application lifecycle in IIS 7.0, on msdn and confused by the following line about halfway down , "The first time that an ASP.NET page or process is requested in an application, a new instance of the HttpApplication class is…
user48408
  • 3,234
  • 11
  • 39
  • 59
0
votes
1 answer

mvc webApi, why application start again?

I work in durandal Project, which built on mvs web api. However, some-time it arrived to function Application_Start (in Global.asax) again, at running time. Why?! It must happen once, when first request arrives to server! For example, in…
0
votes
0 answers

Asp.Net Application_Start called again, after login

Debugging my code in VS, I've seen that Global.asax´s Application_Start method is being called twice: First when the server starts Second after login The login method does: AuthenticationCookie.SetSessionCookie(userName); …
0
votes
1 answer

What would cause Application_Start causing sessions to be lost?

I have a website hosted on a live server where my session continue to be lost. I have added some logging to my global.asax to check when application starts and ends and where session starts and ends as well as if there is an application error. When…
Pomster
  • 14,567
  • 55
  • 128
  • 204
0
votes
0 answers

Check if code is executing inside Application_Start

Can I check if my exception handler code (registered in Application_Error) is running inside of Application_Start? Tn an ASP.NET app in IIS 7 integrated mode there's RequestContext inside the Application_Start method (see this answer). Right now…
just.another.programmer
  • 8,579
  • 8
  • 51
  • 90
0
votes
1 answer

Application_Start is invoked frequently,

I had an issue that my Cache is being removed then added frequently, (i add it in the Application_Start) after some debugging i found that the method Application_Start is invoked almost every 10-20 mins, it seems like my application is being…
Hilmi
  • 3,411
  • 6
  • 27
  • 55
0
votes
3 answers

asp.net mvc application not working after publish

i have a wired problem with my app. as along as i run my app using visual studio, there is no problem but when i try to publish and run it using IIS i get the following error [NullReferenceException: Object reference not set to an instance of an…
0
votes
2 answers

onPause() and onResume() functions while designing the home screen

I am designing an Home Screen in which I am showing the applist in a gridview. There are some animation in the 1st screen of my HOMESCREEN and when you press on a button then a grid is shown. So, the problem is that; 1)).I opened an application from…
Custadian
  • 845
  • 1
  • 11
  • 37
0
votes
1 answer

Open or create a text file every day on Application_Start and Append with requested web pages then close on Application_End

I have been tasked with running a simple audit that will record each and every page that has been requested by any user and store the data of the page and if access was granted or denied based on existing security trimming. I am thinking along the…
Splunk
  • 491
  • 1
  • 9
  • 24
0
votes
1 answer

& Application_Start event

So - after much research, it appears that the < identity impersonate=true > only works AFTER the Application_Start event fires. Does anyone know any workaround to this problem? I have an application which needs to create the database when the…
eejai42
  • 736
  • 2
  • 12
  • 24
0
votes
1 answer

Global.asax Application_Start run on bin-folder update?

My question is quite simple.. What if I have an application.. and I start it, and then I assume that Application_Start will be hit.. But what if I during runtime add another assembly to the bin-folder.. would this cause the application to rebuild…
Inx
  • 2,364
  • 7
  • 38
  • 55
0
votes
3 answers

background thread in asp.net application

i run a background thread in Application_Start() in global.asax to use it like windows service but applicaton_end fire when all session is ended in my website i have a sms Business that work with webservice and i want to have agent in my server…
-1
votes
2 answers

How to start up your .NET program from web browser?

Could you provide example of JavaScript function for starting up application installed on your computer from a web browser (eg google chrome 4). It particular if .Net APPs have any special simplifying this process apis of out there are some libs for…
Rella
  • 65,003
  • 109
  • 363
  • 636
-2
votes
1 answer

Telegram bot in asp.net Application_Start

I write a telegrom bot with c# and put it in my asp.net web application . but does not work using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Security; using System.Web.SessionState; using…
MMSH
  • 59
  • 9
1 2 3 4 5
6