473,405 Members | 2,310 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

TrustAllCertificatePolicy

Hi,

I am having some problems with missing intermediate root certificates in a
production env.
"The underlying connection was closed: Could not establish trust
relationship with remote server."

As I have understood it one way of solving this issue is to use the
"ServerCertificateValidationCallback" and implement the "ICertificatePolicy"
in a class and make the check return "True".

My question is this...

I have a factory that returns my client proxy...
MyService proxy = ServiceFactory.GetMyService();

//Calling Synchronous operations on the proxy
string id = proxy.SomeMethod();

//Calling Asynchronous operations on the proxy
proxy.BeginAnotherMethod(id, dataObj);
....

Is it sufficent to add the following code before the Factory call i.e.
before any operations have been invoked on the proxy or..??
Before calling the "new" operator on the proxy??
Before every operation called on the proxy??

//Using the callback
ServicePointManager.ServerCertificateValidationCal lback =
TrustAllCertificatePolicy.TrustAllCertificateCallb ack;
// The override...
public class TrustAllCertificatePolicy : System.Net.ICertificatePolicy
{
public static bool TrustAllCertificateCallback(object sender,
X509Certificate cert, X509Chain chain, SslPolicyErrors errors)
{
return true;
}

public bool CheckValidationResult(System.Net.ServicePoint srvPoint,
X509Certificate certificate, System.Net.WebRequest request, int
certificateProblem)
{
return true;
}
}
Regards
/Oscar
Oct 2 '06 #1
0 3334

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Ashutosh Bhalerao | last post by:
Hi all, I am trying to write a VB.Net application which communicates over SSL with an IIS server. I have got a temporary certificate from Verisign and installed it on IIS. I am using...
1
by: Guru | last post by:
Hi I am accessing the TransUnionNetAccess's secured site requesting for the Credit Score. Since i have the p12 certificate i am using third party dll to convert p12 to x509 certificate. ...
0
by: Mackuack | last post by:
Hello everybody i have the following code to access an application via https: --------------------------------------------- System.Net.ServicePointManager.CertificatePolicy = new...
9
by: Justin Engelman | last post by:
Hi, I have a website that uses an ISAPI filter that will redirect anyone going to any page on the site to an SSL login page (on a different website with the same root domain) if they do not have...
0
by: Tony Archer | last post by:
Here's my problem... When I use this code to hit the site in question I'm redirected to another SSL login page. If processed successfully the page creates a cookie and then redirects you to the...
1
by: Susan | last post by:
My windows application contains a browser, which is used to browse to HTTPS sites. The Security Alert dialog comes up stating that the name on the certificate doesn't match the name of the site. I...
3
by: I'm spent | last post by:
Does anyone know how to accept all certificates when a site is browsed to through the axwebbrowser in a windows application? Thanks.
2
by: Stewart Bourke | last post by:
I have added the following class to my code for consuming a webservice. I want to be able to accept all certificates for testing etc.. public class TrustAllCertificatePolicy :...
0
by: YuS.Mei | last post by:
I have the following function to call net service in .NET 1.1 version. It works great. System.Net.ServicePointManager.CertificatePolicy is obsolete and it's suggested to use...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.