D
DevDude
I am using the following code to make a connection to a remote web service
running on my windows 2003 server. The server is in a domain using
Certificate Services. I have assigned a certificate to the default web site
and configured it. I can connect to the web service using IE, but when
trying to make a web connection via my application, I get various errors. I
can't seem to make it work. Here is a similar example to my code:
service.Url = @"https://" + Server + @"/WebService1/WebService1.asmx";
System.Net.NetworkCredential NC = new NetworkCredential();
ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
NC.UserName = username;
NC.Password = password;
NC.Domain = domain;
service.Credentials = NC;
try
{
if (service.IsConnected())
{
return true;
}
else
{
return false;
}
}
catch(Exception except)
{
MessageBox.Show(except.Message);
}
return false;
When I am not using https, things connect fine. When I use https, I get
"Unable to read data from the network connection", inner exception is "the
remote certificate failed validation procedure".
Is there something I'm doing wrong, or is this simply not supported with
Windows Mobile?
I can't seem to find any clear answers out there. I have added the root
certificate to my mobile device store and it doesnt change the error
returned. Can anyone tell me how to make it work securly? I need to pass
admin credentials around with other various sensitive data and I need a
secure connection from the mobile device. Microsoft is doing it with
Outlook, so you would think it should work.
Thanks in advance,
Nick
running on my windows 2003 server. The server is in a domain using
Certificate Services. I have assigned a certificate to the default web site
and configured it. I can connect to the web service using IE, but when
trying to make a web connection via my application, I get various errors. I
can't seem to make it work. Here is a similar example to my code:
service.Url = @"https://" + Server + @"/WebService1/WebService1.asmx";
System.Net.NetworkCredential NC = new NetworkCredential();
ServicePointManager.CertificatePolicy = new TrustAllCertificatePolicy();
NC.UserName = username;
NC.Password = password;
NC.Domain = domain;
service.Credentials = NC;
try
{
if (service.IsConnected())
{
return true;
}
else
{
return false;
}
}
catch(Exception except)
{
MessageBox.Show(except.Message);
}
return false;
When I am not using https, things connect fine. When I use https, I get
"Unable to read data from the network connection", inner exception is "the
remote certificate failed validation procedure".
Is there something I'm doing wrong, or is this simply not supported with
Windows Mobile?
I can't seem to find any clear answers out there. I have added the root
certificate to my mobile device store and it doesnt change the error
returned. Can anyone tell me how to make it work securly? I need to pass
admin credentials around with other various sensitive data and I need a
secure connection from the mobile device. Microsoft is doing it with
Outlook, so you would think it should work.
Thanks in advance,
Nick