HttpWebRequest is not posting

J

Jeff Washburn

Hi All,

I have an HttpWebRequest object that is supposed to post data to a web
page. The server is receiving the data, and I am getting an OK
response. However, the data is not ending up on the server. I put a
test on the server, and it shows that a hit is being made, but that is
all.

Here is the code I am using:

Dim content as string =
"txtName=Fred&txtNumber=123&txtData=ABC123"
Dim wr As HttpWebRequest = WebRequest.Create(url)
Dim s As Stream
wr.Method = "POST"
wr.ContentType = "application/x-www-form-urlencoded"
wr.ContentLength = content.Length
s = wr.GetRequestStream
Dim sw As New StreamWriter(s, Encoding.ASCII)
sw.Write(content)
sw.Close()
sw = Nothing
Dim wRes As HttpWebResponse = CType(wr.GetResponse,
HttpWebResponse)
wr.Abort()
wr = Nothing
s = Nothing
wRes.Close()
wRes = Nothing

Does anyone have any ideas why the data is not ending up on the
server? I have triple checked the spelling of the control names.

Thanks!!
Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top