Webservice calls throwing exception with SecureChannelFailure status

  • Thread starter Thread starter Simon Shearn
  • Start date Start date
S

Simon Shearn

Hello -

I'm trying to connect to a secure (HTTPS) webservice from a device running
..NET Compact Framework. I'm using the HttpWebRequest class. In cases where
the server is unavailable, unplugged for example, I find that this class
throws a webxception with status SecureChannelFailure. This is a problem,
because my application needs to distinguish between low-level network
problems and problems at the SSL/certificate level.

Possible solutions include:
1) Abandoning HttpWebRequest and working at the socket level (lots of work)
2) Trying to check the status of the server in some other way (eg. HTTP,
ping, etc)

Is there anything else I should be trying to make HttpWebRequest return a
more helpful exception status?

Thanks
 
Simon,

I would think that a value of ConnectionFailure would indicate that you
have a low-level network problem as opposed to a problem with the
certificate. I would think that a problem with the certificate would give
you a TrustFailure value in the WebException.

Also, have you checked the InnerException property on the WebException?
That could give you more information as well.

Hope this helps.
 
Nicholas Paldino said:
Simon,

I would think that a value of ConnectionFailure would indicate that you
have a low-level network problem as opposed to a problem with the
certificate. I would think that a problem with the certificate would give
you a TrustFailure value in the WebException.

Also, have you checked the InnerException property on the WebException?
That could give you more information as well.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Simon Shearn said:
Hello -

I'm trying to connect to a secure (HTTPS) webservice from a device running
.NET Compact Framework. I'm using the HttpWebRequest class. In cases where
the server is unavailable, unplugged for example, I find that this class
throws a webxception with status SecureChannelFailure. This is a problem,
because my application needs to distinguish between low-level network
problems and problems at the SSL/certificate level.

Possible solutions include:
1) Abandoning HttpWebRequest and working at the socket level (lots of
work)
2) Trying to check the status of the server in some other way (eg. HTTP,
ping, etc)

Is there anything else I should be trying to make HttpWebRequest return a
more helpful exception status?

Thanks
Thanks for the reply. I'm not sure whether I've looked at the inner
exception or not, will check tomorrow. The webservice call works fine when
the server is available, so I'm taking that as an indication that the
certificate is OK.
 
Back
Top