HTTP post method using VB.Net
HTTP post method using VB.Net
HTTP post method using VB.Net
HTTP post method using VB.Net
HTTP post method using VB.Net
HTTP post method using VB.Net HTTP post method using VB.Net HTTP post method using VB.Net HTTP post method using VB.Net HTTP post method using VB.Net HTTP post method using VB.Net HTTP post method using VB.Net HTTP post method using VB.Net
HTTP post method using VB.Net HTTP post method using VB.Net
HTTP post method using VB.Net
Go Back  Xtreme Visual Basic Talk > > > HTTP post method using VB.Net


Reply
 
Thread Tools Display Modes
  #1  
Old 04-06-2004, 12:00 AM
Blitzkrieg99 Blitzkrieg99 is offline
Regular
 
Join Date: Jan 2004
Location: Singapore
Posts: 68
Default HTTP post method using VB.Net


Hello everyone.

I tried doing a search and the only results that came out were related to Legacy Visual Basic. Does anyone know how do i go about using the HTTP Post method in .NET? Thanks
Reply With Quote
  #2  
Old 04-08-2004, 03:57 PM
excaliber's Avatar
excaliberHTTP post method using VB.Net excaliber is offline
Senior Contributor

* Expert *
 
Join Date: Nov 2002
Location: Ohio, USA
Posts: 1,828
Default

Code:
Dim oWeb As New System.Net.WebClient() oWeb.Headers.Add("Content-Type", "application/x-www-form-urlencoded") Dim bytArguments As Byte() = System.Text.Encoding.ASCII.GetBytes("q=InTheory") Dim bytRetData As Byte() = oWeb.UploadData("http://www.google.com/search", "POST", bytArguments ) debug.Write(System.Text.Encoding.ASCII.GetString(bytRetData))

This declares a new object as a Webclient. We use the Headers.Add method to add in the appropriate headers for form data. Then we create a byte array and set it equal to that search string (q is the query variable for google). We create another byte array that is set to the return value (what the server sends back). It does this by the UploadData method (which accepts the URL, the type of packet, and any arguments).

Then we write it to the debug screen (just for demonstration) by converting back to a string.
__________________
RandomIRC - Your neighborhood's friendly IRC channel (irc.randomirc.com - #code)

"Perl - The only language that looks the same before and after RSA encryption."
Reply With Quote
  #3  
Old 04-11-2004, 08:37 PM
Blitzkrieg99 Blitzkrieg99 is offline
Regular
 
Join Date: Jan 2004
Location: Singapore
Posts: 68
Default

Thanks for that excaliber. Helped a lot.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP, INet - how to terminate requests LegatoX Communications 0 02-29-2004 01:48 PM
File I/O In VB.Net MikeJ Tutors' Corner 1 02-28-2004 09:49 PM
How to submit a form from VB app to some webpage like HTML POST Method isaami Communications 0 01-12-2004 08:43 AM
I'm sorry to post it here, needs exposure pied_piper Word, PowerPoint, Outlook, and Other Office Products 0 06-11-2003 06:39 PM
Filtering unique items MarkG General 24 08-18-2001 01:44 AM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
HTTP post method using VB.Net
HTTP post method using VB.Net
HTTP post method using VB.Net HTTP post method using VB.Net
HTTP post method using VB.Net
HTTP post method using VB.Net
HTTP post method using VB.Net HTTP post method using VB.Net HTTP post method using VB.Net HTTP post method using VB.Net HTTP post method using VB.Net HTTP post method using VB.Net HTTP post method using VB.Net
HTTP post method using VB.Net
HTTP post method using VB.Net
 
HTTP post method using VB.Net
HTTP post method using VB.Net
 
-->