send data to web server

N

nondos

hi

i have this html code that do search everytime i click on the button
<FORM action=http://www.url.com/?s=somthing method=post><INPUT
type=submit value="search" name=src>

now i want to do the same thing but in vb.net
any idea how to do it?

notice to the way the data send to the server in the html code
(method=post)

thanks
 
A

Andrew Morton

nondos said:
i have this html code that do search everytime i click on the button
<FORM action=http://www.url.com/?s=somthing method=post><INPUT
type=submit value="search" name=src>

now i want to do the same thing but in vb.net
any idea how to do it?

notice to the way the data send to the server in the html code
(method=post)

It might be different in the .NET 2.0 framework, but in the 1.1 framework
you'd be wanting to look at System.Net.HttpWebRequest and set

..Method = "POST"
..ContentType = "application/x-www-form-urlencoded"

Don't forget to set the .ContentLength. To send the data, you use a
StreamWriter (Dim myWriter As New StreamWriter(webReq.GetRequestStream())),
and to get a handle to the response you need a WebResponse.

Using that handle, you use a StreamReader to actually read the data.

Don't forget to use try..catch liberally as Internet communication is not
fault-free.

HTH

Andrew
 
H

Herfried K. Wagner [MVP]

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

Top