1

I have some websites with order forms. How can I log timeout if it occurs. Where is the place can I put my log code?

vNext
  • 1,102
  • 4
  • 16
  • 28
  • Please be more specific. You just want to write to a log file if some user's session times out? Or you want to notify the user somehow? What do you mean exactly by timeout? – Chris Shain Feb 07 '12 at 01:59
  • Do you mean a session timeout or a request timeout? Obviously, if the request to the server times out, then either the server never got the request in the first place (so you can't log it), or the client never received the response. – jhsowter Feb 07 '12 at 02:03
  • I mean a request (a posting) timeout. Not session timeout! – vNext Feb 07 '12 at 02:16

1 Answers1

3

Here's how I log Session timeouts in my app in Global.asax.cs

protected void Session_End()
{
NLogger.Log("Session {0} has ended.", new String[] { Session.SessionID, Session.Timeout.ToString()}, NLogger.Info);
}
jhsowter
  • 619
  • 3
  • 8
  • You can't log a request that never reaches the server. Why do you want to log these anyway? – jhsowter Feb 07 '12 at 02:29
  • It reached to server but maybe my server takes too much time to process so I need to log it to know and fix – vNext Feb 07 '12 at 02:31
  • If you have a long running process, you should manage the timeout yourself instead of letting the server do it. You can increase the timeout if you need to as well. Is that what you need to know? – jhsowter Feb 07 '12 at 02:43
  • I mean how can I catch request timeout in Application_Error()? – vNext Feb 07 '12 at 03:49