468,107 Members | 1,343 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Sending https:// Request in .Net Compact Framework 2.0

Hi All,

I am trying to send an https:// request from my .Net CF application. The code is as follows :

HttpWebRequest request = ( HttpWebRequest )
WebRequest.Create( https://www.anyServer.com );

request.Method = "GET";

HttpWebResponse webResponse =
( HttpWebResponse )request.GetResponse();
catch( WebException e1 )
MessageBox.Show( e1.Message );

After sending the request im getting an exception that says "trust failure". I know that it is because of the root certificate is not installed on the device root certificate store.

But if I want to validate server sertificate on the device, than how can I do this ?
How can I read the certificate infomration sent by server to device ?

Thanks in advance.
Apr 26 '07 #1
3 1469
759 Expert 512MB
Are you running the Application in the default ASPNET account ?
Apr 26 '07 #2
759 Expert 512MB
Refer this for your error. You will resolve if my assumption was correct on your exception.


Apr 26 '07 #3
Are you running the Application in the default ASPNET account ?

Hi Red,

Sorry for posting the question twice !!

Actually Im trying it from a .Net Compact Framework Application with a PocketPc 2003 Second Edition device.

I have found some solutions. It might be because of the CA certificate was not installed on my device. When I sent the request to server for which a CA certificate is there on ny device, it worked fine.

But still I have some problems. The source is as follows

ServicePointManager.CertificatePolicy = new MyPolicy();

class MyPolicy : ICertificatePolicy
public bool CheckValidationResult( ServicePoint srvPoint,
X509Certificate certificate, WebRequest request, int certificateProblem )
return true;

My problem is that for any situation this code will always return "true".
can you suggess:

1) how can I store my own certificate on device.
2) how can I validate the server certificate against my own certificate.

Thanks in advance.
Apr 28 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

1 post views Thread by Ashutosh Bhalerao | last post: by
9 posts views Thread by Michael Evanchik | last post: by
2 posts views Thread by MarkAurit | last post: by
5 posts views Thread by lanclot | last post: by
1 post views Thread by Solo | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.