Solved

Supressing Browser's Certificate Error Message in C# 4.0

Posted on 2011-09-29
16
1,841 Views
Last Modified: 2013-12-17
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?
0
Comment
Question by:SidGBF
  • 9
  • 6
16 Comments
 
LVL 74

Expert Comment

by:käµfm³d 👽
Comment Utility
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
 
LVL 17

Expert Comment

by:Carlos Villegas
Comment Utility
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
 
LVL 17

Expert Comment

by:Carlos Villegas
Comment Utility
0
 

Author Comment

by:SidGBF
Comment Utility
WindowsInterop

Open in new window

Isn't recognized by my system.
0
 
LVL 17

Expert Comment

by:Carlos Villegas
Comment Utility
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
 

Author Comment

by:SidGBF
Comment Utility
@yv989c: What type of project?
0
 
LVL 17

Expert Comment

by:Carlos Villegas
Comment Utility
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
 

Author Comment

by:SidGBF
Comment Utility
nice... it just didn't worked...
This is the url:

https://webvpn02.portalfiat.com.br/
0
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
LVL 17

Expert Comment

by:Carlos Villegas
Comment Utility
It work for me....
Active
 Active
Inactive
 Inactive
What IE version is in your environment? Windows version?
0
 

Author Comment

by:SidGBF
Comment Utility
IE 9, Win 7
Active and:
active
0
 
LVL 17

Accepted Solution

by:
Carlos Villegas earned 500 total points
Comment Utility
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
 
LVL 17

Expert Comment

by:Carlos Villegas
Comment Utility
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
 

Author Comment

by:SidGBF
Comment Utility
sb.ToString() is always empty
0
 
LVL 17

Expert Comment

by:Carlos Villegas
Comment Utility
At this point is always empty?
 Screen
0
 

Author Closing Comment

by:SidGBF
Comment Utility
A lot of attention from the expert.
The solution is a bit handy, but he was accurate on finding the issue.
0
 
LVL 17

Expert Comment

by:Carlos Villegas
Comment Utility
Thanks, glad to help.
0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Microservice architecture adoption brings many advantages, but can add intricacy. Selecting the right orchestration tool is most important for business specific needs.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now