G
Guest
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.
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.