473,657 Members | 2,582 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

multipart message from WebRequest (asynchronous)

How do you retrieve the streaming 'parts' of a multipart message from a
WebRequest?

Here is the situation.

A WebRequest is submitted to a server (http://TheServer:80/GetMedia?ID=1).
This causes the server to push/stream a multipart message back to the client
in the following format:

HTTP/1.1 200 OK
Date: Fri, 24 Feb 2006 12:01:31 CST
Server: MyServer/1.0
Content-type: multipart/x-mixed-replace;boundar y=Separator

--Separator
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-Length: 11346

<binary data>

--Separator
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-Length: 11346

<binary data>

--Separator--

In the callback for BeginGetRespons e, the get response I get the response
from the EndGetReponse method. The response stream contains the first 'part'
(everything between the first and second '--Separator', ie both the headers
and binary data). How do I get the rest of the message parts?
Feb 24 '06 #1
1 1967
Thus wrote KReichert,
How do you retrieve the streaming 'parts' of a multipart message from
a WebRequest?

Here is the situation.

A WebRequest is submitted to a server
(http://TheServer:80/GetMedia?ID=1). This causes the server to
push/stream a multipart message back to the client in the following
format:

HTTP/1.1 200 OK
Date: Fri, 24 Feb 2006 12:01:31 CST
Server: MyServer/1.0
Content-type: multipart/x-mixed-replace;boundar y=Separator
--Separator
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-Length: 11346
<binary data>

--Separator
Content-Type: image/jpeg
Content-Transfer-Encoding: binary
Content-Length: 11346
<binary data>

--Separator--

In the callback for BeginGetRespons e, the get response I get the
response from the EndGetReponse method. The response stream contains
the first 'part' (everything between the first and second
'--Separator', ie both the headers and binary data). How do I get the
rest of the message parts?


The response stream is just that -- a stream of bytes. It has no notion of
parts. You have to make sure that you read all bytes from the response stream
before continuing higher level processing such as parsing parts.

Cheers,
--
Joerg Jooss
ne********@joer gjooss.de
Feb 25 '06 #2

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

Similar topics

8
12215
by: Du | last post by:
I'm trying to automate the upload process to yousendit.com, but the file size doesn't add up and yousendit.com keep rejecting my upload (it accepts the upload until the very end) I don't know what i'm missing, I use Fiddler and I got my header and body to a very close match, but the content-length is slightly off and I got no clue why Sorry for the lengthy post, but i have no other way of showing my work
1
4810
by: LD | last post by:
Hi, I'm pulling my hair out!! My problem is, I need to automatically upload a zip file along with 3 other pieces of text data to a web server and wait for it's xml response. Basically a multipart/form-data post. I have tried it using a regular html form and it works but that is no good because it leaves you at the other server where
0
1313
by: DotNetShadow | last post by:
Hi Guys I came across this article which deals with Performance Considerations for Making Web Service Calls from ASPX Pages: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnservice/html/service07222003.asp The article talks about 3 approaches synchronous | asyncronous | and PrerequestHandler with asynchronous calls. I tried the sample that came with the article and the concept proves right.
7
17291
by: Mark Waser | last post by:
Hi all, I'm trying to post multipart/form-data to a web page but seem to have run into a wall. I'm familiar with RFC 1867 and have done this before (with AOLServer and Tcl) but just can't seem to get it to work in Visual Basic. I tried coding it once myself from scratch and then modified a class that I found on a newsgroup (referenced below). Both seem to be doing the same thing and neither works (or rather, they seem to work but the...
5
5585
by: archana | last post by:
Hi all i am having application which is using asychronous web request. At a time i am processing 5 urls asynchronously. Application working properly for 5 asynchronous call. But sometimes CPU usage suddently increases to 100 %. Can some one tell me why this is happening.
0
1430
by: thomasabcd | last post by:
Hi, During the user's registration I wan't to geo-code an address using localsearchmaps.com/geo. For that purpose I use a webrequest like this: string url = "http://www.localsearchmaps.com/geo/?street=" + StreetNumber + "+" + StreetName + "&city=" + City + "&country=DK&google2=1"; System.Net.WebRequest webRequest =
0
1708
by: scottf35 | last post by:
Hi, I am working on (read that - upgrading) an application. This application creates an HTTPWebRequest object, populates it with values which are then sucked out of the Request.Form object (eg someVariable = Request.Form) My problem is that the app doesn't allow input of non-ASCII data in the form. To resolve this I have replace the ContentType from "application/x-www-form-urlencoded" to "multipart/form-data".
1
4409
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 would give it a try. First of all, I am using Visual Studio 2005 to write my program. I am using C# .NET as the language. I am running Windows XP Professional with all service packs and updates applied. Now, I have been trying to write a...
0
4079
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 "The remote server returned an error: (500) Internal Server Error". Obviously, this means that I have not posted all the parameters as the servlet requested. But I just can't seem to find out what went wrong with my code. Hope someone can enlighten me,...
0
8392
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8305
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8503
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4151
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4302
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.