Sending a HTTP Request from a Windows Application

A

Andre Grumbach

Hi NG,

I have a little Problem.

I make a normal HTML page which does following:

When I click the Button Submit, I send some fields to the Server back.

Here the Stream that my Browser sends to the Server:



POST http://sbscrm/MSCRMSERVICES/NoteUpload.srf HTTP/1.0
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword,
*/*
Referer: http://10.0.1.238/AttachmentHelpers/note_upload.htm
Accept-Language: de
Content-Type: multipart/form-data;
boundary=---------------------------7d41dd840021e
Proxy-Connection: Keep-Alive
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.2; .NET CLR
1.1.4322)
Host: sbscrm
Content-Length: 1426
Pragma: no-cache



-----------------------------7d41dd840021e
Content-Disposition: form-data; name="AttachmentType"



5
-----------------------------7d41dd840021e
Content-Disposition: form-data; name="AttachmentId"



{08FC8376-E0B0-48BF-985E-6C6C9E0EFE04}
-----------------------------7d41dd840021e
Content-Disposition: form-data; name="UserId"



{0EC47076-1022-45D7-966C-1CF56B393169}
-----------------------------7d41dd840021e
Content-Disposition: form-data; name="MerchantId"



{9515BDA2-5549-4CBE-BF1C-84C8FFA0CDDF}
-----------------------------7d41dd840021e
Content-Disposition: form-data; name="ErrorURL"



http://sbscrm/AttachmentHelpers/error.htm
-----------------------------7d41dd840021e
Content-Disposition: form-data; name="SuccessURL"



http://sbscrm/AttachmentHelpers/NoteDownload.htm
-----------------------------7d41dd840021e
Content-Disposition: form-data; name="userFile"; filename="C:\user.txt"
Content-Type: text/plain



UserID:{0EC47076-1022-45D7-966C-1CF56B393169}
Merchantid:{9515BDA2-5549-4CBE-BF1C-84C8FFA0CDDF}



Note1:{BD6B7AEA-314F-48DA-8490-08CD749D2E01}
Note2:{08FC8376-E0B0-48BF-985E-6C6C9E0EFE04}
Note3:{C268E4C9-28B8-4105-B4AE-13ADF029DA2C}
Note4:{DB359EC6-D0C9-4B8D-B93A-029F97523123}



AttachmentID:{9515BDA2-5549-4CBE-BF1C-84C8FFA0CDDF}
-----------------------------7d41dd840021e
Content-Disposition: form-data; name="UPL"



Submit
-----------------------------7d41dd840021e--

Now I want following:

When I click a button on a Windows Application, i want to send this stream
with some other values back to the Server.

Now I have search on a lot of pages and newsgroups, and found the following
helps:

With the class HttpWebRequest and WebRequest, it should be possible to send
such a Message to the HTTP Server.



My problem:

I didn't know how I can use this class without any error.

Can somebody of you help me?
 
J

Joerg Jooss

Andre said:
Hi NG,

I have a little Problem.

I make a normal HTML page which does following:

When I click the Button Submit, I send some fields to the Server back.

Here the Stream that my Browser sends to the Server:
[...]
Now I have search on a lot of pages and newsgroups, and found the
following helps:

With the class HttpWebRequest and WebRequest, it should be possible
to send such a Message to the HTTP Server.



My problem:

I didn't know how I can use this class without any error.

Can somebody of you help me?

Well, what *exactly* is your problem? What you want to do is to send a
multipart/form-data request, which is currently not properly supported by
the .NET ftamework, but there are sample implementations available on the
Web that show hoe to do that using HttpWebRequest.

Cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top