I have been trying to access a webservice and keep getting the following error. Is this a problem with my server or with the server i am contact with? Thanks.
The remote certificate is invalid according to the validation procedure.
Description:
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
Source Error:
Line 32: <System.Web.Services.Protocols.SoapDocumentMethodAttribute("https://idd.infocasa.com/webservices/GetSecurityToken", RequestNamespace:="https://idd.infocasa.com/webservices/", ResponseNamespace:="https://idd.infocasa.com/webservices/", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _ Line 33: Public Function GetSecurityToken(ByVal userName As String, ByVal password As String) As String Line 34: Dim results() As Object = Me.Invoke("GetSecurityToken", New Object() {userName, password}) Line 35: Return CType(results(0), String) Line 36: End Function
1- Make sure the certificate is valid (i.e., make sure that you're calling correctly to the server to ensure the three validity rules are satisfied).
2- Tell .NET to simply ignore if the certificate is invalid. This is the easiest solution, though the less secure one (as you might end up accepting certificates for forged sites, etc.).
You can do number 2 by specifying a certificate policy that accepts all certificates.
First I'd try to do it by configuration:
<servicePointManager checkCertificateName="true" checkCertificateRevocationList="false" />
If that doesn't work, you can implement the ICertificatePolicy interface in your own class and tell the endpoint manager to use that:
internal class AcceptAllCertificatePolicy : ICertificatePolicy
{
public AcceptAllCertificatePolicy()
{
}
Description:
An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Line 18: </Etier.CreditCard> Line 19: Line 20: <servicePointManager checkCertificateName="true" checkCertificateRevocationList="false" /> Line 21: Line 22: <appSettings>
Can you help me??? thanks
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
ServicePointManager.CertificatePolicy is obsolete by now.
I was able to ignore the certificate invalidity by doing this:
public PasswordHints_BO()
{
//It so happen that the DEV certificates are invalid. Let the server callback when a certificate comes in
ServicePointManager.ServerCertificateValidationCallback = RemoteCertificateValidationCB;
}
public static bool RemoteCertificateValidationCB(Object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors )
{
//If it is really important, validate the certificate issuer here.string resultsTrue = certificate.Issuer.ToString(true);
//For now, accept any certificatereturn true;
}
Try the easy solution first before changing code. I had the same issue. My web server was trying to call a web service on the app server through a firewall. For some reason everything worked fine if I debugged in Visual Studio. But if I called my app from
a browser I always received this message.
I had installed my signed SSL cert on the app server as well as the CA Root cert on the app server.
However, the CA Root cert needed to be installed on the web server as well. I had failed to do this when receiving the error.
Once I installed the CA Root cert on the web server everything worked fine.
As a side note, I did not import it using IE. I installed it using mmc.
We had the same error message. It turned out that the Fiddler application was intercepting and modifying the traffic. By turning off the "Decrypt HTTPS traffic" option, the web service call started working.
my application deployed on one server..where ssl is installed and web service is in different server and different location and when i will be access to web service i am getting this error..but if i will acces without ssl to that web service its working
fine...pls help out
jaldridge1
Member
320 Points
64 Posts
The remote certificate is invalid...
Jul 26, 2005 12:50 PM|LINK
The remote certificate is invalid according to the validation procedure.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.Exception Details: System.Security.Authentication.AuthenticationException: The remote certificate is invalid according to the validation procedure.
Source Error:
Line 32: <System.Web.Services.Protocols.SoapDocumentMethodAttribute("https://idd.infocasa.com/webservices/GetSecurityToken", RequestNamespace:="https://idd.infocasa.com/webservices/", ResponseNamespace:="https://idd.infocasa.com/webservices/", Use:=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)> _Line 33: Public Function GetSecurityToken(ByVal userName As String, ByVal password As String) As String
Line 34: Dim results() As Object = Me.Invoke("GetSecurityToken", New Object() {userName, password})
Line 35: Return CType(results(0), String)
Line 36: End Function
Source File: D:\Websites\www2Sunseekerhomes\web\iddtest.aspx Line: 34
Stack Trace:
jaldridge1
Member
320 Points
64 Posts
Re: The remote certificate is invalid...
Jul 26, 2005 09:58 PM|LINK
narayanas
Contributor
3320 Points
662 Posts
Re: The remote certificate is invalid...
Jul 27, 2005 12:40 AM|LINK
http://pluralsight.com/blogs/mgudgin/archive/2005/06/01/9694.aspx
tomasr
Contributor
4290 Points
852 Posts
Re: The remote certificate is invalid...
Jul 27, 2005 11:34 AM|LINK
1- Make sure the certificate is valid (i.e., make sure that you're calling correctly to the server to ensure the three validity rules are satisfied).
2- Tell .NET to simply ignore if the certificate is invalid. This is the easiest solution, though the less secure one (as you might end up accepting certificates for forged sites, etc.).
You can do number 2 by specifying a certificate policy that accepts all certificates.
First I'd try to do it by configuration:
<servicePointManager checkCertificateName="true" checkCertificateRevocationList="false" />
If that doesn't work, you can implement the ICertificatePolicy interface in your own class and tell the endpoint manager to use that:
internal class AcceptAllCertificatePolicy : ICertificatePolicy
{
public AcceptAllCertificatePolicy()
{
}
public bool CheckValidationResult(ServicePoint sPoint,
X509Certificate cert, WebRequest wRequest,int certProb)
{
// Always accept
return true;
}
}
ServicePointManager.CertificatePolicy = new AcceptAllCertificatePolicy();
tomasr@mvps.org
rekoms
Participant
1354 Points
275 Posts
Re: The remote certificate is invalid...
Jan 23, 2007 09:05 AM|LINK
Hi Tomas,
I have tried - to implement your solution - but:
Server Error in '/' Application.
Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.Parser Error Message: Unrecognized configuration section servicePointManager.
Source Error:
Can you help me??? thanks
Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.210
rekoms
Participant
1354 Points
275 Posts
Re: The remote certificate is invalid...
Jan 23, 2007 09:11 AM|LINK
I havent inserted in
<system.net>
<settings>
<servicePointManager checkCertificateName="true" checkCertificateRevocationList="false" />
</settings>
</system.net>
But I am getting still the previous error :-(
JohnAbot
Member
2 Points
1 Post
Re: The remote certificate is invalid...
Jul 05, 2007 06:15 PM|LINK
CoderNYC
Member
2 Points
1 Post
Re: The remote certificate is invalid...
Mar 13, 2008 05:01 PM|LINK
Try the easy solution first before changing code. I had the same issue. My web server was trying to call a web service on the app server through a firewall. For some reason everything worked fine if I debugged in Visual Studio. But if I called my app from a browser I always received this message.
I had installed my signed SSL cert on the app server as well as the CA Root cert on the app server.
However, the CA Root cert needed to be installed on the web server as well. I had failed to do this when receiving the error.
Once I installed the CA Root cert on the web server everything worked fine.
As a side note, I did not import it using IE. I installed it using mmc.
olja
Member
151 Points
44 Posts
Re: The remote certificate is invalid...
Mar 25, 2008 08:41 PM|LINK
We had the same error message. It turned out that the Fiddler application was intercepting and modifying the traffic. By turning off the "Decrypt HTTPS traffic" option, the web service call started working.
rajansharma7...
Member
2 Points
1 Post
Re: The remote certificate is invalid...
Jun 20, 2008 12:36 AM|LINK
hi,
i am also getting same error,
my application deployed on one server..where ssl is installed and web service is in different server and different location and when i will be access to web service i am getting this error..but if i will acces without ssl to that web service its working fine...pls help out