Hack Forums
[.NET] The underlying connection was closed: The connection was closed unexpectedly - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] The underlying connection was closed: The connection was closed unexpectedly (/showthread.php?tid=4018463)



The underlying connection was closed: The connection was closed unexpectedly - geraldososa - Jan 24, 2014

What the code does is gets the source of the website.
My code is:
Code
Dim str As String = Me.RandomString(10).ToLower()

      Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://mailnesia.com/mailbox/" & str), HttpWebRequest)

      Dim postresponse As HttpWebResponse

      postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)

      System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Ssl3
      Dim postreqreader As New StreamReader(postresponse.GetResponseStream())
      Dim thepage As String = postreqreader.ReadToEnd

      Dim match As Match = Regex.Match(thepage, "\b([0-9a-z]){32}\b")
      If match.Success Then
      LogInRichTextBox1.Text = match.Groups(0).Value
      MsgBox(match.Groups(0).Value)
      End If
I tried using webclient to get the source. But i still get the error.


* - nathan72389 - Jan 25, 2014

maybe your random string dont exist?


* - geraldososa - Jan 25, 2014

I tried using it without the string and just the url but it still does not work.


* - ident - Jan 25, 2014

[Image: 6d6e0554b3b3b7815171cd0fa9042f6e.png]


* - geraldososa - Jan 25, 2014

Ident thank you now it works i love you baby.