I am currently trying to get a response from a server that is using SSL in C#. I have the code to do this in Java, but it looks like they do not translate 1:1.

I do have some code that I found that works for regular pages, but not for the one I need (maybe because of the SSL thing). Here is the code:

        WebRequest request = WebRequest.Create("https://" + sslServerHost + ":" + sslServerPort);
    request.Proxy = null;
    request.Credentials = CredentialCache.DefaultCredentials;

    HttpWebResponse response = (HttpWebResponse)request.GetResponse();
    Stream dataStream = response.GetResponseStream();
    StreamReader reader = new StreamReader(dataStream);
    string responseFromServer = reader.ReadToEnd();

UPDATE: Sorry I seem to have forgotten what the error is. I'm getting a protocol violation exception at the "HttpWebResponse response = (HttpWebResponse)request.GetResponse(); " line. Any ideas? Thanks guys.

Edit
Report