Last post Dec 26, 2011 07:00 PM by varunthedon
Dec 22, 2011 10:29 AM|epatmalnieks|LINK
Hi, I have my site hosted with GoDaddy.com and I have a problem. It seems my code runs perfectly as long as the browser stays open. If I close the browser, then reopen it immediately, everything still works great. However, if I close the browser and wait,
say, 25 minutes, I open up my site and can't even log in! Any idea as to why this is happening? It is something to do with my global.asax file pasted below. My code is just checking a table in the database every minute.
void Application_Start(object sender, EventArgs e)
// Dynamically create new timer
System.Timers.Timer timScheduledTask = new System.Timers.Timer();
// Timer interval is set in miliseconds,
// In this case, we'll run a task every minute
timScheduledTask.Interval = 60 * 1000;
timScheduledTask.Enabled = true;
// Add handler for Elapsed event
void timScheduledTask_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
// Execute some task
GoalReminder gr = new GoalReminder();
int howOften = 1;
while (howOften < 5)
//do some stuff here that i can't paste
Dec 22, 2011 03:20 PM|Pradeep Kr. Sharma|LINK
I do not know what you are trying check in DataBase. Some time developer check DataBase when it is updating from multiple sources. Timer implemented in application so that if any user is viewing some data and at the same time the data is updating by some
other user. Then timer will check the database record time to time and show an alert that Record has updated by other user. Sothat if user can get alert and also can get updated data.
If you are also doing the same then you can implement TIMER in a user control or master page and you can add that control in all the required pages.
I hope this approach will help you.
Let me know if you need any help.
Visit My Blog http://vshelpdesk.blogspot.com/To help others, don't forget to mark the post as answer if it answered your question.
Dec 26, 2011 07:00 PM|varunthedon|LINK
In IISManager, enable HTTP-Keep Alives for your application.
In IIS Manager, select Http Response Headers Module, open it and in the Actions Pane, select
Set Common Headers and in there select Enable Http Keep Alives.
Also, check for a setting of your application pool -
Select the application pool of your application, select Advanced Settings from the right Actions Tab.
In there there is a setting called - Idle Timeout (minutes)
By default it is 20 Minutes. Make it something like 60 Minutes or increase it even more and check.
If you got your solution, please mark this as answer, so that it might help others if they face similar problem.