HTTP POST in VB.NET

jensen

New member
Joined
Jul 25, 2005
Messages
1
Programming Experience
Beginner
Hi There,

I am trying to create a VB Applications that automatically logs into
a web page and retrieves data.

The problem is that i have to log in to the page through a form. This form uses POST and i can't seem to create a http post method. Are there in simple example for creating a HTTP POST function?

I have tried following example, but could not make it to work

Dim web As New System.Net.WebClient
web.Headers.Add("Content-Type", "application/x-www-form-urlencoded")
Dim d As Byte() = System.Text.Encoding.ASCII.GetBytes("SEARCHSTRING=post")
Dim res As Byte()

Try

res = web.UploadData(url, "POST", d)

Catch wex As WebException

End Try

ret = System.Text.Encoding.ASCII.GetString(res)

Thanks,

 
Back
Top