streams and querystrings

G

Guest

I need to provide data to a cgi script on a remote site from my asp.net web
form. The script expects a querystring containing the data. I want to keep
the user at my site, and submit the data programmatically and transparently.
Can I use something similar to:

Dim objHTTP As Net.WebRequest =
Net.WebRequest.Create("https://www.website.org/cgi-local/register2004.cgi")

objHTTP.Method = "POST"
objHTTP.ContentType = "application/x-www-form-urlencoded"
objHTTP.ContentLength = strForm.Length

Dim stOut As System.IO.StreamWriter = New
IO.StreamWriter(objHTTP.GetRequestStream, System.Text.Encoding.ASCII)
stOut.Write(strForm)
stOut.Close()

to do this? Thanks!
 
J

Joerg Jooss

John said:
I need to provide data to a cgi script on a remote site from my
asp.net web form. The script expects a querystring containing the
data. I want to keep the user at my site, and submit the data
programmatically and transparently. Can I use something similar to:

Dim objHTTP As Net.WebRequest =
Net.WebRequest.Create("https://www.website.org/cgi-local/register2004.
cgi")

objHTTP.Method = "POST"
objHTTP.ContentType = "application/x-www-form-urlencoded"
objHTTP.ContentLength = strForm.Length

Dim stOut As System.IO.StreamWriter = New
IO.StreamWriter(objHTTP.GetRequestStream, System.Text.Encoding.ASCII)
stOut.Write(strForm)
stOut.Close()

to do this? Thanks!

Yes, you can use WebRequest or WebClient from your ASP.NET page code.

Cheers,
 
G

Guest

Thanks, that did, indeed, work. I needed another opinion because I wasn't
seeing the result I expected, ie, values written to their database. Turns out
that was due to some flakiness on their end.

Thanks Joerg Jooss!
 

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,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top