Click to See Complete Forum and Search --> : [RESOLVED] ASP.NET C#: Reading in data from "HTML GET", using "POST" to send data without a form


Nightcat
02-18-2009, 07:20 AM
Hi Guys

I have a little problem. I have been asked to set up PDT for PayPal.

I usualy write things in PHP, but the company I work for now, only has an ASP.NET server. Which leaves me with realy just one option :(

As it stands, I did learn ASP.NET C# some time ago. Now the book I have on ASP.NET does not show how to read in data from "HTML GET"

And I also need to work out how to POST some data back to PayPal for security check. For POST I found this link:
http://404i.com/elasticelephant/2008/09/09/posting-from-net-web-form/

But still not sure about it. So any help would be realy appreciated.

Thanks

chazzy
02-18-2009, 08:04 AM
the only example i have floating around is in VB.NET, but it should be pretty straight forward to change it into C#, just don't have the brain functions yet this morning to rewrite it.


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 )

Nightcat
02-20-2009, 07:47 AM
Thanks alot for the reply

Turns out the page was writen in VB.NET and as far as I can see, all the necessary functions are there. But as I only ever worked with C#, I'm screwed anyway :(

The person that set up that page seems to have used all prepared templates, but the decided not to do anything else :mad:

slackeramus
02-27-2009, 05:36 PM
System.Net.WebClient oWeb = New System.Net.WebClient();

oWeb.Headers.Add("Content-Type", "application/x-www-form-urlencoded");

Byte[] bytArguments = System.Text.Encoding.ASCII.GetBytes("q=InTheory");
Byte[] bytRetData = oWeb.UploadData("http://www.google.com/search", "POST", bytArguments );

Translation is 1 to 1. Hope I didn't leave out anything.

Nightcat
03-02-2009, 04:22 PM
Thanks alot for transleting in to C#

I'll sure have plenty of use for this code :)