Unable to make a connection to HTTPS through proxy in .net CF

G

Guest

I'm unable to make a https connection through a proxy server using the
compact framework.
I am trying to make a connection to HTTPS using WebRequest.But i can able to
connect to HTTP not for HTTPS.
I am getting exception like "Could not establish secure channel for SSL/TLS".
I have tried with the following,
1. I have implemented ICertificatePolicy and i made
CheckValidationResult() to return always true.
2. I have set httpwebrequest.AllowWriteStreamBuffering = true.
3. I have opened the https site in pocket pc IE before acessing it thru
code.
But still i am getting the exception.

I know this is a bug in .net CF and fixed for a future release.
If anybody know the release version.Please let me know.
Is there any otherway to access HTTPS through proxy using WebRequest or am i
missing anything in my code?


The following is the code ,which i am using to connect HTTPS.

private void btnHTTPS_Click(object sender, System.EventArgs e)
{
string url="https://www.....";

System.Net.ServicePointManager.CertificatePolicy=new
TrustAllCertificatePolicy();
WebProxy proxyObject = new WebProxy("address",true);
proxyObject.Credentials = new NetworkCredential
("userid", "password");
GlobalProxySelection.Select = proxyObject;
Char[] read = new Char[1024];
HttpWebRequest req
=(HttpWebRequest)WebRequest.Create(url);
req.KeepAlive=false;
req.Method = "POST";
req.AllowWriteStreamBuffering = true;
req.ContentType="application/x-www-form-urlencoded";
HttpWebResponse result
=(HttpWebResponse)req.GetResponse()
Stream Receive = result.GetResponseStream();
StreamReader sr = new StreamReader(Receive);
int count = sr.Read( read, 0, 1024 );
while (count > 0)
{
String str = new String(read, 0, count);
listBox1.Items.Add(str);
count = sr.Read(read, 0, 1024);
}
Receive.Close();
}




public class TrustAllCertificatePolicy:System.Net.ICertificatePolicy
{

public bool CheckValidationResult(ServicePoint sp,
X509Certificate cert,WebRequest req, int problem)
{
return true;
}


}


Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top