469,903 Members | 1,899 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,903 developers. It's quick & easy.

Detect and handle Request Timeout

Hi,

I'm wondering how I can find out when a request timeout has occurred and
handle it programmatically.

Here's is what I have so far:

// This handler is added to the web application's Error event
// somewhere else with this code:
// this.Error += new EventHandler( D2LWebApp_Error );
private void WebApp_Error( object sender, EventArgs e ) {
Exception exception = Server.GetLastError();
HttpException he = exception as HttpException;

if( he != null && string.Compare( he.Message, "Request timed out." ) == 0
) {
// handle the timeout somehow
}
}

This codes does work and can detect the timeout for me. However, I'm not
thrilled about relying on a string compare with the exception message!!!

Does anyone know of a better way to do this?

Thanks!
Brian.

ps - I know about the ErrorCode property of HttpException, but when a
timeout happens, it is set to -2147467259. I don't think that this number is
specific to timeout, but is a more general error code.
May 4 '06 #1
0 1492

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Cam | last post: by
4 posts views Thread by Dst | last post: by
5 posts views Thread by Jonah Bishop | last post: by
3 posts views Thread by nms | last post: by
4 posts views Thread by goscottie | last post: by
1 post views Thread by Waqarahmed | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.