The remote certificate is invalid according to the validation procedure.

Vinisha 1 Reputation point
2021-10-06T02:42:11.037+00:00

The remote certificate is invalid according to the validation procedure.

I am getting this error on the IIS server while making a web API call to external web service in C# and ASP.Net. if i run the code on my local Visual Studio, I am not getting that error and it works fine. I am not able to find why this error is being thrown, can somebody shed some light? thanks.

Windows development | Internet Information Services
Developer technologies | C#
Developer technologies | C#

An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.


1 answer

Sort by: Most helpful
  1. Hu Linning 0 Reputation points
    2025-07-30T23:56:28.06+00:00

    if you do not use certificate then ignore it by calling this:

    VB.NET code:

    ServicePointManager.ServerCertificateValidationCallback = Function(s As Object, certificate As X509Certificate, chain As X509Chain, sslPolicyErrors As SslPolicyErrors) True

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.