Link to home
Start Free TrialLog in
Avatar of ZuZuPetals
ZuZuPetalsFlag for United States of America

asked on

Raw HTTP POST using C# .Net? Is there such a thing as a POST w/o fields? (Convert Perl to .Net)

Background: In the past when I've done a HTTP POST, it's always been in a web form submit scenario.  I have experience adding name/value pairs to NameValueCollection and passing that to the .Net library class WebClient.UploadValues.  Voila.

Current problem: I'm currently required to POST some XML but apparently there are no fields. I'm guessing this is a "raw" HTTP Post? I guess I haven't encountered this before.

Question: What does this mean?  Is there such a thing as a "raw" HTML Post w/o form fields? I have some example Perl code below that does it (attached).

How do I pull off a raw HTTP POST using C# .Net?  Do I use UploadData(string address, byte[] data) ???
my $ua = new LWP::UserAgent;

$ua->agent("post.pl/1.0 " . $ua->agent);

my $request = new HTTP::Request POST => $url;

$request->push_header("FileType", "SomeThing");
$request->content_type('text/xml');
$request->content("$authentication");

my $results = $ua->request($request);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of alexey_gusev
alexey_gusev
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
in above link, ignore "parameters", set your content type and then write xml into request stream