C# Programming
07-16-2009, 11:51 AM
Dear Friends,
I stuck at a point, to download a file from HTTPS site.
I have a secured web site https/www.mySite.com/.
I havent any idea which Certificate that server is using.
I just want to down load a file from that site.
For that I have written the code:
private static bool ValidateRemoteCertificate(
object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors policyErrors
)
{
if (policyErrors == SslPolicyErrors.None)
return true;
else
return false;
));
// // Do not allow this client to communicate with unauthenticated servers.
// return false;
// }
but it always shows the error "System.Net.Security.SslPolicyErrors.RemoteCertificateNameMismatch"
and if i forcefully return true it works fine...
what is proper solution??????
thnaks in advance
I stuck at a point, to download a file from HTTPS site.
I have a secured web site https/www.mySite.com/.
I havent any idea which Certificate that server is using.
I just want to down load a file from that site.
For that I have written the code:
private static bool ValidateRemoteCertificate(
object sender,
X509Certificate certificate,
X509Chain chain,
SslPolicyErrors policyErrors
)
{
if (policyErrors == SslPolicyErrors.None)
return true;
else
return false;
));
// // Do not allow this client to communicate with unauthenticated servers.
// return false;
// }
but it always shows the error "System.Net.Security.SslPolicyErrors.RemoteCertificateNameMismatch"
and if i forcefully return true it works fine...
what is proper solution??????
thnaks in advance