Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

The request was aborted: The connection was closed unexpectedly. HTTPWEBREQUEST

I get this error when I try to send POST Data and log my self in a website. Any ideas?

The request was aborted: The connection was closed unexpectedly.

This is my code

Code
Imports System.Net
Imports System.Text
Imports System.IO

Public Class Form1

    Dim logincookie As CookieContainer

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

  Dim postData As String = "username=" & Username.Text & "&password=" & Password.Text & "&LoginBTN="
  Dim tempCookies As New CookieContainer
  Dim encoding As New UTF8Encoding
  Dim byteData As Byte() = encoding.GetBytes(postData)

  Dim postReq As HttpWebRequest = DirectCast(WebRequest.Create("http://respawn.ca/login.php"), HttpWebRequest)
  postReq.Method = "POST"
  postReq.KeepAlive = True
  postReq.CookieContainer = tempCookies
  postReq.ContentType = "application/x-www-form-urlencoded"
  postReq.Referer = "http://respawn.ca/login.php"
  postReq.UserAgent = "Mozilla/5.0 (Windows; U; Windows NT 6.1; ru; rv:1.9.2.3) Gecko/20100401 Firefox/4.0 (.NET CLR 3.5.30729)"
  postReq.ContentLength = byteData.Length

  Dim postreqstream As Stream = postReq.GetRequestStream()
  postreqstream.Write(byteData, 0, byteData.Length)
  postreqstream.Close()
  Dim postresponse As HttpWebResponse

  postresponse = DirectCast(postReq.GetResponse(), HttpWebResponse)
  tempCookies.Add(postresponse.Cookies)
  logincookie = tempCookies
  Dim postreqreader As New StreamReader(postresponse.GetResponseStream())

  Dim thepage As String = postreqreader.ReadToEnd

  RichTextBox1.Text = thepage

    End Sub

End Class

As you can see from the code, I'm trying to make myself a portable version of Respawn Stresser for myself. I'm quite new to httpwebrequest, so any help is appreciated.

EDIT: Just realized that I sounded like I didn't know what the error meant. I am wondering how I can fix that.

I think the http headers may be wrong, but I am not sure.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by HardStoNMay 2, 2021 12:59 AM 5 267 May 2, 2021 12:59 AM
Last Post: vaiperboy
[C#] by draxyeeSep 10, 2019 01:37 PM 12 379 Sep 10, 2019 01:37 PM
Last Post: MavenGradle
[.NET] by freesixJan 19, 2019 02:14 AM 13 490 Jan 19, 2019 02:14 AM
Last Post: StarZ