Further Exception Identification

  • Thread starter Thread starter Martin
  • Start date Start date
M

Martin

Hi All

I am fairly new to C# and the exception classes of Microsoft.Net. I
hope someone can help me. I am trapping exceptions in a web
application and currently reporting the exception detail. Two of the
main exceptions I receive are :
The underlying connection was closed: Unable to connect to the
remote server.
The operation has timed-out.

Both are System.Net.WebException type exceptions. Is there an easy way
for me to distinguish between the two.

Any help would be gratefully received.

Martin Wright
 
Hello, Martin!

M> I am fairly new to C# and the exception classes of Microsoft.Net. I
M> hope someone can help me. I am trapping exceptions in a web
M> application and currently reporting the exception detail. Two of the
M> main exceptions I receive are :
M> The underlying connection was closed: Unable to connect to the
M> remote server.
M> The operation has timed-out.

M> Both are System.Net.WebException type exceptions. Is there an easy way
M> for me to distinguish between the two.

Yes, you can use WebException.Status property, it returns WebExceptionStatus enum.

--
Regards, Vadym Stetsyak
www: http://vadmyst.blogspot.com
 
Back
Top