Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Programmatically posting form data to a web page and getting result in .net

Reply
Thread Tools

Programmatically posting form data to a web page and getting result in .net

 
 
Ghafran Abbas
Guest
Posts: n/a
 
      10-12-2004
To programmatically post form data to a web page and get the result in
..net, use the following code.

===========Begin Code================

Imports System.Net

Public Sub PostDataToForm()

'URL to post the data to
Dim strPostText As String = "http://www.google.com"

Dim myWebClient As New WebClient
Dim mypostvalues As New NameValueCollection

'Add Post Fields Here
'The first parameter is the name of the field, the second is the
value
mypostvalues.Add("hl", "en")
mypostvalues.Add("q", "test search")

Try
Dim responseData As Byte() = myWebClient.UploadValues(strPostText,
mypostvalues)
sResponse = Encoding.ASCII.GetString(responseData)
Catch
'Handle Error Here
Finally
myWebClient.Dispose()
End Try

End Function

===========End Code================
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How can I create an innocuous SQL injection attempt to test apps and evaluate the result programmatically? ASP .Net 7 03-16-2007 04:19 PM
Posting to web app and reading result Stanley Beamish ASP General 0 08-22-2005 09:40 AM
Posting to web app and reading result Stanley Beamish ASP .Net 2 08-21-2005 02:30 PM
1. Ruby result: 101 seconds , 2. Java result:9.8 seconds, 3. Perl result:62 seconds Michael Tan Ruby 32 07-21-2005 03:23 PM
FORM POST ONSUBMIT (from non-frames page : result to _self Frame page) J Kester Javascript 0 12-23-2003 03:26 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57