Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Supressing Browser's Certificate Error Message in C# 4.0

Posted on 2011-09-29
16
Medium Priority
?
2,232 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 9
  • 6
16 Comments
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 36817307
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
ID: 36817661
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
ID: 36817673
0
WEBINAR - Latest Cyber Tips for Defense

Join the WatchGuard Threat Research Team on October 26th for an informative webinar featuring expert tips and tricks for defending your organization from today's latest cyber threats. Don't leave yourself vulnerable to attack. Register for the webinar today!

 

Author Comment

by:SidGBF
ID: 36891258
WindowsInterop

Open in new window

Isn't recognized by my system.
0
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 36891403
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
ID: 36891415
@yv989c: What type of project?
0
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 36891436
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
ID: 36891559
nice... it just didn't worked...
This is the url:

https://webvpn02.portalfiat.com.br/
0
 
LVL 17

Expert Comment

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

Author Comment

by:SidGBF
ID: 36891667
IE 9, Win 7
Active and:
active
0
 
LVL 17

Accepted Solution

by:
Carlos Villegas earned 2000 total points
ID: 36891742
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
ID: 36891761
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
ID: 36891845
sb.ToString() is always empty
0
 
LVL 17

Expert Comment

by:Carlos Villegas
ID: 36891873
At this point is always empty?
 Screen
0
 

Author Closing Comment

by:SidGBF
ID: 36892066
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
ID: 36892104
Thanks, glad to help.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
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…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…

610 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