Analysis of methods for c#httpwebrequest access to HTTPS error handling

Source: Internet
Author: User
The following small series for everyone to bring a C # HttpWebRequest Access HTTPS error handling method. Small series feel very good, now share to everyone, also for everyone to make a reference. Let's take a look at it with a little knitting.

C # HttpWebRequest encountered this error while accessing the HTTPS link, but if I open the grab bag tool, such as Filddler2, Post returns to normal

The message for the error message is:

The underlying connection has been closed: An error occurred while sending.

InnerException is:

Unexpected EOF or 0 bytes received from the transport stream.

Tried the online n method, the following is the solution:

Servicepointmanager.securityprotocol = SECURITYPROTOCOLTYPE.SSL3;

Make a list of the solutions you find online, and maybe you'll be able to solve your problem.

Here are the solutions found online:

1. Request. ProtocolVersion = Httpversion.version10;

2. Servicepointmanager.servercertificatevalidationcallback = new Remotecertificatevalidationcallback ( CheckValidationResult);

3.servicepointmanager.securityprotocol = Securityprotocoltype.tls;

4. Try a different useragent.

5. Add the following in App. Config:

<system.net>  <settings>   
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.