I am trying to use the HttpWebRequest
class in order to get a page's html content. The page address is started with https
so it means I need to establish the connection over SSL protocol. Now the problem is, when I run my code block, it throws an exception saying :
Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. system.net.sockets.socketexception
My Code
var request = (HttpWebRequest)WebRequest.Create("https://www.***.com/");
var response = (HttpWebResponse)request.GetResponse();
What I'v tried to solve the problem
I think my code lacks of something which unfortunately I don't know what exactly it is! I changed the URL's content and used a http
link and the code ran well. I'v read a lot of links and tried different ideas but it still doesn't work.
My questions
Would anyone tell me if it is possible to Get
the content of a https
address?
If it is possible, how could I achieve it?
And if it is not, how do the internet browsers explore the address while they are nothing more than blocks of code written by some programmers?!