SSL connection issues

From everything that I have read, I really shouldn't have to do anything different when doing a HTTPS Post compared to a HTTP Post.  Unfortunatelly, I keep getting an error when I try the HTTPS Post.  My first impression was that the Certificate was not placed in the proper store but I have since verified that it is there.  Here is my test code as I was tired of re-writing my entire page, I created a test HTTPS that just does a ping onto the box that I'm trying to attach to.  This works from my browser on the same machine so I figured that it would be a good test.

<script runat="server" language="VB">
Sub Page_Load(sender As Object, e As EventArgs)

      Dim mgWebRequest As HttpWebRequest
      Dim stringPost, stringResult As String
      Dim mgStreamWriter As StreamWriter
      Dim mgWebResponse As HttpWebResponse
      Dim mgStreamReader As StreamReader

      mgWebRequest = CType(WebRequest.Create("https://somewebsite/ping"),HttpWebRequest)
      mgWebRequest.Method = "POST"
      mgWebRequest.KeepAlive = True
      stringPost = "Test"
      mgWebRequest.ContentLength = stringPost.length 'length
      mgWebRequest.ContentType = "application/x-www-form-urlencoded"
      mgStreamWriter = Nothing
      mgStreamWriter = New StreamWriter(mgWebRequest.GetRequestStream())
      mgWebResponse = CType(mgWebRequest.GetResponse(),HttpWebResponse)
      mgStreamReader = New StreamReader(mgWebResponse.GetResponseStream())
      stringResult = mgStreamReader.ReadToEnd()

End Sub

The error that I receive is a varyiant of:

"The underlying connection was closed: An unexpected error occured on a send."
"The underlying connection was closed: Could not establish secure channel for SSL/TLS."
"The request was aborted: The connection was closed unexpectedly."

I enabled schannel event logging and everything looks good from that aspect:

1. An SSL server handshake completed successfully.
2. An SSL client handshake completed successfully.
3. An SSL server handshake completed successfully.
4. An SSL client handshake completed successfully.
5. Creating an SSL client credential.
6. An SSL client handshake completed successfully.
7. An SSL client handshake completed successfully.

Any Help would be greatly appreciated at this point...

10/3/2005 3:03:23 PM 91979 articles. 3 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 23