Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8625017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T07:40:39+00:00 2026-06-12T07:40:39+00:00

I have a simple app that uses the C# Web Client class to download

  • 0

I have a simple app that uses the C# Web Client class to download a websites HTML. This is a stripped down sample of the code I’m using:

WebClient wc = new WebClient();
wc.Headers.Add("user-agent",
    "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR 1.0.3705;)");
htmlCode = wc.DownloadString("https://www.oig.hhs.gov/exclusions/exclusions_list.asp");

There seems to be an issue with the websites certificate, because I encounter this exception:

The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel." "The remote certificate is invalid according to the validation procedure.

If you copy and paste the link into a browser, it requires you to agree to the risks before allowing you to view the site. Its a government website, so I’m not worried about any viruses or anything. Is there anyway to tell the web client to bypass this issue, and continue to the site?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T07:40:40+00:00Added an answer on June 12, 2026 at 7:40 am

    As far as I know this is because they use a invalid or expired SSL certificate. You can bypass (ignore) it by using:

    ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true;
    

    Edit 2015:

    This post is getting a lot of upvotes, but I regret my answer. It may remove your error, but it won’t fix the issue. Accepting any SSL certificates will leave you vulnerable for man in the middle attacks, so it’s generally a very bad idea. I will leave this answer for future reference, but please take note that you should try to fix the issue at the root, namely by making sure the SSL certificate is valid.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a fairly simple web app that uses cookies to store some information
I have a simple ASP.NET web app which uses a WCF Client to talk
I have put together a simple ASP.NET MVC 3 test web app that uses
I have a small web app that uses a simple username/password login scheme. I've
I am building a PhoneGap/Cordova app and have a simple code that uses http://ricostacruz.com/jquery.transit/
This is a real newbie question. I have simple app that selects a picture
I have a simple catalogue app that lets users download product data from an
I have a simple GAE app that includes a login/logout link. This app is
I have a small app that a client uses to manually update some data.
Some colleagues of mine have a large Java web app that uses a search

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.