I have asp.net application. I am forcibly end this application and on the time of that i want to update my view page count value in database. If anyone known plz help me.
I also written code in global.asax file
void Application_End(object sender, EventArgs e)
{
// Code that runs on application shutdown
}
but this is not working when i forcibly end application. 
Nishant MittalPosted Dec 2, 2015, 8:20 AM
Mohammad AmanPosted Dec 2, 2015, 5:48 AM
Nishant MittalPosted Dec 2, 2015, 12:11 AM
Its in general not a good idea to put a lot of code in Application_End that you need to rely on firing. Consider that an ApplicationInstance is started to each thread of the work process that will be serving your application, you will run into scenarios where your Application_End will be called frequently on a busy site as traffic ebbs and flows.
You may find it easier to use a Cache object with a sliding expiration and a callback function when the object expires from Cache to ensure that your clean up code is called properly when you need it.
http://msdn.microsoft.com/en-us/library/05kd8d77(v=vs.110).aspx
Mohammad AmanPosted Dec 2, 2015, 12:01 AM
Nishant MittalPosted Dec 1, 2015, 11:43 PM