By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,640 Members | 2,094 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,640 IT Pros & Developers. It's quick & easy.

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

P: 4
Hi All,

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

try
{
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
Share this Question
Share on Google+
3 Replies


radcaesar
Expert 100+
P: 759
Are you running the Application in the default ASPNET account ?
Apr 26 '07 #2

radcaesar
Expert 100+
P: 759
Refer this for your error. You will resolve if my assumption was correct on your exception.

http://msdn2.microsoft.com/en-us/library/aa302408.aspx

:)
Apr 26 '07 #3

P: 4
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.