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>