473,396 Members | 2,013 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Using HttpWebRequest to Post a byte array

I currently use httpwebrequest to download large byte array files from my
server. I am curious about how to change my httpwebrequest code to allow
posing a large byte array to a virtual foldeer. This is my download code
which work well in
returning a large byte array from the server:

Function GetImageFromURL(ByVal url As String) As Byte()
allDone.Reset()
Try
Dim wr As HttpWebRequest = DirectCast(WebRequest.Create(url), HttpWebRequest)
If Not ProxyObject Is Nothing Then wr.Proxy = ProxyObject
Dim MRS As New RequestState
MRS.request = wr
Dim result As IAsyncResult = CType(wr.BeginGetResponse(AddressOf
RespCallBack, MRS), IAsyncResult)
allDone.WaitOne()
MRS.response.Close()
Return MRS.ReturnBLOB
Catch MyException As Exception
End Try
End Function

Private Sub RespCallBack(ByVal asyncResult As IAsyncResult)
Dim MRS As RequestState = CType(asyncResult.AsyncState, RequestState)
Dim wr2 As HttpWebRequest = CType(MRS.request, HttpWebRequest)
MRS.response = CType(wr2.EndGetResponse(asyncResult), HttpWebResponse)
Dim RS As Stream = MRS.response.GetResponseStream()
MRS.responseStream = RS
Dim br As BinaryReader = New BinaryReader(MRS.responseStream)
Dim bytesize As Long = MRS.response.ContentLength
MRS.ReturnBLOB = br.ReadBytes(CInt(bytesize))
allDone.Set()
End
Nov 23 '05 #1
0 2293

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Kueishiong Tu | last post by:
I have a url, I pass it to Webclient, and I get response without any problem. String* uriString = S"trade7.masterlink.com.tw/futures/QuotePrice.jsp"; String* postData = S""; // Create a new...
4
by: supster | last post by:
Hello, I am trying to use HttpWebRequest to simulate sending some POST data from a form to a PHP script. I have accomplished this using: HttpWebRequest req = (HttpWebRequest)...
6
by: Mike Koerner | last post by:
Hi, I am having problems setting the HttpWebRequest Date header. I understand that it is a restricted header and I do receive the "This header must be modified with the appropriate property." ...
7
by: | last post by:
Hello, I would like to do the following from a asp.net button click: <form method="POST" action="https://www.1234.com/trans_center/gateway/direct.cgi"> <input type="hidden" name="Merchant"...
5
by: bg | last post by:
Hi all. I 'm trying to automate some of my workflow, by doing some programmatic "POST"s to an internal webserver via HttpWebRequest. The Code is your usual straight forward type of thing. ...
4
by: Natalia | last post by:
Hello, I need to provide the ability to post file and some form elements via our website (asp.net) to the third party website (asp page). On http://aspalliance.com/236#Page4 - I found great...
0
by: sanjaygupta11 | last post by:
I am using httpwebrequest and httpwebresponse objects for sending data to remote appication by post and receiving the response from there. I am using this code in my windows application which will...
1
by: WeCi2i | last post by:
Okay, I have a problem that has been stumping me for weeks. I have tried many different solutions and this is pretty much my last resort. I have seen a lot of good answers give here so I figured I...
0
by: shlim | last post by:
Currently I'm using VB.Net to perform a http/https multipart form post to a servlet. I'm able to perform the post using HttpWebrequest via GetRequestStream(). However, the servlet returned me with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.