EldoS | Feel safer!

Software components for data protection, secure storage and transfer

POST mit stream

Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.
Posted: 06/25/2014 04:13:47
by Walter Schrabmair (Priority Standard support level)
Joined: 05/03/2013
Posts: 149

I would like to post a MEMOBOX as MemoryStream.
But when I post the memorystream I get Content-Lenght: 0

Headers sent:
POST /search.aspx?searchtype=msds HTTP/1.0
Cookie: $Version="1"; ecm="user_id=0&isMembershipUser=0&site_id=&username=&new_site=/&unique_id=0&site_preview=0&langvalue=1033&DefaultLanguage=1033&NavLanguage=1033&LastValidLanguageID=1033&DefaultCurrency=840&SiteCurrency=840&ContType=&UserCulture=1033&dm=www.avantormaterials.com&SiteLanguage=1033&Country=United States&CountryKey=Americas:United States"; $Path="/"; $Domain="www.avantormaterials.com"; EktGUID="0c5580b0-0027-450e-9783-7c3501275e92"; $Path="/"; $Domain="www.avantormaterials.com"; EkAnalytics="0"; $Path="/"; $Domain="www.avantormaterials.com"; AvantorLangcookie="Language=1033&Country=United States&CountryKey=Americas:United States"; $Path="/"; $Domain="www.avantormaterials.com"; AvantorAlert="true"; $Path="/"; $Domain="www.avantormaterials.com"; ASP.NET_SessionId="davkkmvwhk3hdlagq0va230j"; $Path="/"; $Domain="www.avantormaterials.com"
Host: www.avantormaterials.com
User-Agent: SecureBlackbox
Accept-Encoding: gzip, deflate
Content-Length: 0

here my code:
      MyPostStream := TMemoryStream.Create;

      ElHttpsClient1.Post( 'https://www.avantormaterials.com/search.aspx?searchtype=msds',MyPoststream);

What make I wrong?
Posted: 06/25/2014 04:16:30
by Eugene Mayevski (EldoS Corp.)

You need to set MyPostStream.Position back to 0 after writing to it. Our components don't rewind any passed streams (that's by design).

Sincerely yours
Eugene Mayevski
Posted: 06/25/2014 04:16:41
by Vsevolod Ievgiienko (EldoS Corp.)

Try to modify the code next way:
MyPostStream := TMemoryStream.Create;
MyPOSTStream.Position := 0; // add this line
Posted: 06/25/2014 04:24:21
by Walter Schrabmair (Priority Standard support level)
Joined: 05/03/2013
Posts: 149

thanks a lot.

One more question: How can I put the sent data in a MemoBox?
I know that there is the event OnSentData but how can I put the Buffer in a Memobox? Please show me some code how it is done. Thanks a lot!
Posted: 06/25/2014 04:26:45
by Vsevolod Ievgiienko (EldoS Corp.)

Please check our HTTPGet sample. It does similar thing in OnData event handler.
Posted: 06/25/2014 05:04:55
by Walter Schrabmair (Priority Standard support level)
Joined: 05/03/2013
Posts: 149

I will do, thanks.
Also by EldoS: CallbackProcess
A component to control process creation and termination in Windows and .NET applications.



Topic viewed 581 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!