using webrequest

  • Thread starter Thread starter andy
  • Start date Start date
A

andy

Hi


I have a requirement to submit form data to a url after collecting the
data from the database.
For example I need to send firstname and lastname through a post method

I can call on the fly.


This is the traditional route below , I want to emulate this submit
action from a vb.class using request.method="post"
<FORM action="http://somesite.com/prog/adduser" method="post">
First name: <INPUT type="text" name="firstname"><BR>
Last name: <INPUT type="text" name="lastname"><BR>
email: <INPUT type="text" name="email"><BR>
<INPUT type="submit" value="Send"> <INPUT type="reset">
</FORM>


clear as mud?
Anyone have any tips ?
 
Andy - you can use the ASP.NET server control (button) and then just use the
Http WebRequest class - The code below was used as an example of one way to
determine internet connectivity on the compact framework, but the logic is
the same.

Public Shared Function GotInternet() As Boolean
Dim req As HttpWebRequest
Dim res As HttpWebResponse
Try req = CType(WebRequest.Create("http://www.devbuzz.com"),
HttpWebRequest)
res = CType(req.GetResponse(), HttpWebResponse)
If res.StatusCode = HttpStatusCode.OK Then
GotInternet = True
End If
Catch weberrt As WebException
GotInternet = False
Catch except As Exception
GotInternet = False
End Try
End Function

Here's a pretty good example
(http://www.codeproject.com/csharp/HttpWebRequest_Response.asp)
and here's one that emulates essentially what you are trying to do
(http://www.netomatix.com/HttpPostData.aspx)

Let me know if you have any trouble ...

Bill
 
Back
Top