473,326 Members | 2,438 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

HTTPWebResponse just hangs!

Hi,

I am trying to post data to a url as follows but i don't get any response -
can anyone see anything missing from my code. Note: I have verified the url
(surl) i am targetting does exist. Thanks.

Dim buffer() As Byte = Encoding.UTF8.GetBytes(sPostData)

Dim hwreq As HttpWebRequest = WebRequest.Create(sUrl)

hwreq.Method = "POST"

hwreq.ContentType = "application/x-www-form-urlencoded"

hwreq.ContentLength = buffer.Length

hwreq.CookieContainer = New CookieContainer

Dim hwres As HttpWebResponse = hwreq.GetResponse

!!!!!!Above line never returns!!!!!!


Jul 21 '05 #1
1 1106
Fixed it - i needed to add the following code:

Dim reqstream As Stream = hwreq.GetRequestStream()

reqstream.Write(buffer, 0, buffer.Length)

"John Blair" <jo********@hotmail.com> wrote in message
news:X9***************@newsfe6-gui.ntli.net...
Hi,

I am trying to post data to a url as follows but i don't get any
response - can anyone see anything missing from my code. Note: I have
verified the url (surl) i am targetting does exist. Thanks.

Dim buffer() As Byte = Encoding.UTF8.GetBytes(sPostData)

Dim hwreq As HttpWebRequest = WebRequest.Create(sUrl)

hwreq.Method = "POST"

hwreq.ContentType = "application/x-www-form-urlencoded"

hwreq.ContentLength = buffer.Length

hwreq.CookieContainer = New CookieContainer

Dim hwres As HttpWebResponse = hwreq.GetResponse

!!!!!!Above line never returns!!!!!!

Jul 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Denny Rue | last post by:
I’ve created VB code to download files from a web site through the use of HTTPWebRequest, HTTPWebResponse and BinaryReader. The HTTPWebRequest has a TimeOut property to limit how long it waits...
0
by: hlabbott | last post by:
Hi I'm having a problem displaying attachments correctly. I have messages with attachments stored on Exchange2000 and want to be able to click a hyperlink in my project like in OWA and see an...
5
by: Nathan | last post by:
This is a copy of a message at microsoft.public.dotnet.framework.clr: THE CODE: I'm using an HttpWebResponse object to send an HTTP POST to a Java server I have written and are running on the...
4
by: Nuno Magalhaes | last post by:
In a simple thread I have a code like the one below: public void ProtectionRun() { while(true) { //Sleep thread for one minute //Thread.Sleep(60000); HttpWebRequest...
3
by: Nuno Magalhaes | last post by:
Hello, In a simple thread I have a code like the one below: public void ProtectionRun() { while(true) { //Sleep thread for one minute //Thread.Sleep(60000); HttpWebRequest
1
by: John Blair | last post by:
Hi, I am trying to post data to a url as follows but i don't get any response - can anyone see anything missing from my code. Note: I have verified the url (surl) i am targetting does exist....
2
by: Nuno Magalhaes | last post by:
In pages that there is no content length, how does HttpWebResponse knows where the page ends? And what kind of objects/methods does it retrieve? Does it only retrieve the initial page without any...
1
by: Shayz | last post by:
Hi, I have been working on this code now, well about 5 lines, for 3 days now and I am completely baffled. I have an ASP.NET page whch takes in variables and using them variables pings them to a...
4
by: Mahernoz | last post by:
Hi Friends, I have this code in a C# console application which calls a URL on my website(Asp.net/C#) with Querystrings. (I have also tried without querystrings). The problem is my program...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.