Supressing Browser's Certificate Error Message in C# 4.0

I have a web browser accessing a SSL secure intranet.
The SSL isn't valid, but I need to accept it anyway.

I've read about

        ServicePointManager.ServerCertificateValidationCallback = ValidateRemoteCertificate;


        private static bool ValidateRemoteCertificate(
        object sender,
            X509Certificate certificate,
            X509Chain chain,
            SslPolicyErrors policyErrors
        )
        {
            return true;
        }

Open in new window


but it doesn't work! The error stay.
Can someone help me on this?
SidGBFAsked:
Who is Participating?
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Ok, I found the problem, you will need to change the constants values in the StringConstants.cs file to match your environment language.
 StringConstants
0
 
käµfm³d 👽Commented:
but I need to accept it anyway.
Can you clarify: who needs to accept it? The client receives the server's expired/invalid SSL, or the server receives the client's expired/invalid SSL?
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
I have a web browser accessing a SSL secure intranet.
mmm sorry but ServicePointManager.ServerCertificateValidationCallback does not work with the WebBrowser control, it work for example, for the System.Net.WebRequest class.
I remember see an article that talk about how to avoid the IE warnings... I will try to find it and post back...
0
Live Q & A: Securing Your Wi-Fi for Summer Travel

Traveling this summer? Join us on June 18, 2018 for a live stream to learn about the importance of Wi-Fi security and 3 easy measures you can start taking immediately to protect your private data while using public Wi-Fi. Follow us today to learn more!

 
Carlos VillegasFull Stack .NET DeveloperCommented:
0
 
SidGBFAuthor Commented:
WindowsInterop

Open in new window

Isn't recognized by my system.
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
It work for me:
.Net framework 2.0
Windows 7 and Windows Server 2008 R2 terminal services

What error you see? when try to compile it? when try to run it? can you explain it better?
0
 
SidGBFAuthor Commented:
@yv989c: What type of project?
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
1. Download the project from this link:
http://dl.dropbox.com/u/13237304/EE/WebBrowserControlDialogs.zip
2. Extract the zip file content to a folder.
3. Inside the WebBrowserControlDialogs folder, open the project file named: WebBrowserControlDialogs.csproj

This is a Windows Form application.
0
 
SidGBFAuthor Commented:
nice... it just didn't worked...
This is the url:

https://webvpn02.portalfiat.com.br/
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
It work for me....
Active
 Active
Inactive
 Inactive
What IE version is in your environment? Windows version?
0
 
SidGBFAuthor Commented:
IE 9, Win 7
Active and:
active
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
The key is WindowsInterop.WH_CALLWNDPROCRET_PROC, it uses these constants, so if you make the right changes to StringConstants you will be able to make it work.
0
 
SidGBFAuthor Commented:
sb.ToString() is always empty
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
At this point is always empty?
 Screen
0
 
SidGBFAuthor Commented:
A lot of attention from the expert.
The solution is a bit handy, but he was accurate on finding the issue.
0
 
Carlos VillegasFull Stack .NET DeveloperCommented:
Thanks, glad to help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.