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 8255317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:28:53+00:00 2026-06-08T01:28:53+00:00

I am trying to create an XML document from an https web request, but

  • 0

I am trying to create an XML document from an https web request, but I am having trouble getting it to work when the site has an invalid certificate. I want my application to not care about the certificate, I want it to live it’s life on the edge without fear!

Here is the initial code I had, which I have used before may times to get what I want from a standard http (non SSL) request:

XmlDocument xml = new XmlDocument();
XmlTextReader reader = new XmlTextReader("https://www.example.com");
xml.Load(reader);

With the site having an invalid SSL certificate I am now getting the following error:

The request was aborted: Could not create SSL/TLS secure channel.

Now I have done my Google-ing and tried a number of promising solutions but it seems to be of no help.

One I tried here on SO looked good but didn’t seem to work, I added the ‘accepted answer’ line of code directly before my code above as it wasn’t too clear as where it should go.

In case it makes any difference, my code is in a class library and I am testing via a console app. I am also using .Net 4.


Here is my latest attempt (which does not work):

XmlDocument xml = new XmlDocument();

ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback((s, ce, ch, ssl) => true);

HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlCommand);
request.Credentials = CredentialCache.DefaultCredentials;

using (HttpWebResponse response = (HttpWebResponse)request.GetResponse())
{
    using (Stream receiveStream = response.GetResponseStream())
    {
        XmlTextReader reader = new XmlTextReader(receiveStream);
        xml.Load(reader);
    }
}
  • 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-08T01:28:56+00:00Added an answer on June 8, 2026 at 1:28 am

    OK so I have found the solution. We had opted to try and disable the SSL on the server for testing and noticed it was using SSL 3. After another Google search I found some additional code to fix the issue (important to set the SecurityProtocolType):

    ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
    ServicePointManager.ServerCertificateValidationCallback += new System.Net.Security.RemoteCertificateValidationCallback((s, ce, ch, ssl) => true);
    
    XmlDocument xml = new XmlDocument();
    XmlTextReader reader = new XmlTextReader(urlCommand);
    xml.Load(reader);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create an XSLT to transform an XML document and having
I'm trying to create an XML sitemap using CakePHP, from a table which has
I am trying to create an XML file, but the XML file needs to
I'm trying to query out some information from a heavily namespaced XML document and
I am trying to delete then add a pageFooter to an xml document from
https://tbe.taleo.net/MANAGER/dispatcher/servlet/rpcrouter the above is from Taleo's API guide. I'm trying to create a WCF
I'm trying to parse XML returned from the Youtue API. The APIcalls work correctly
I'm trying to create a portfolio site where my pieces reside in an XML
I'm trying to get a C++ service to load an XML document from a
I am trying to create an XML document with multiple namespaces using System.Xml.Xmlwriter in

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.