I am trying to create an HttpWebRequest which registers the account for me, I am using a loop so that the new Only accounts can be registered with the user, registered with the user. But for some reason it works only twice, for the third time this function "webRequest.GetRequestStream ();" And it will never end, it will not throw any errors or nothing, it's my first HttpWebRequest, and it's pretty dirty. Thinking for people, there is a string with value registration 'value' in there The first 2 times actually registers the accounts, so it works.
Public Static HTTP Webbet () {HttpWebRequest webRequest = WebRequest.Create ("http://87.255.55.218/ Register") as HttpWebRequest; WebRequest.method = "post"; WebRequest.Host = "87.255.55.218"; WebRequest.UserAgent = "hacker"; WebRequest.Accept = "text / html, application / xhtml + xml, application / xml; q = 0.9, * / *; q = 0.8"; WebRequest.Referer = "http://yougothacked.com"; WebRequest.ContentType = "app / x-www-form-url expired"; WebRequest.Headers.Add (HttpRequestHeader.KeepAlive, "115"); Return webRequest; } Public Static Zero Register (String Username) {string value = Value.Replace ("replace", user name); WebRequest webRequest = get (); WebRequest.ContentLength = value.Length; Thread.Sleep (50); Stream REQStream = webRequest.GetRequestStream (); ReqStream.Write (encoding. ASCII.GetBytes (value), 0, value.Length); Thread.Sleep (50); ReqStream.Flush (); ReqStream.Close (); ReqStream.Dispose (); }
What could be wrong?
I strongly suspect that the problem is in some code that you do not Shown - that is, when you request use , you are not properly disposing the response (such as using a
block by using a The code should be inserted using the request stream.)
If you do not resolve the response, then the connection to that response The server will hold until the final manufacturer releases it.
Briefly: Make sure that you have added a response using the
block like this
:
(WebResponse response = req.GetResponse ()) {...}
And I suspect that you do this work but you did it Many have requested.
On the other hand, Darin can make your life easier as a suggestion by using the WebClient
.
Comments
Post a Comment