Help - need to extract boundary separated multi-part data from HttpRequest

J

jjouett

I'm trying to setup an ASPX web page to service requests from an
existing Java Client that posts multi-part data as a way to upload
files, and I can't find a straightforward way to process the request.
From the HttpRequest, the Request.Form and Request.Files collections
are empty. The Request.ContentType states the following:

multipart/form-data, boundary=012AhbCfFg225929

and using the Request.InputStream to get the content results in the
following string:

-----012AhbCfFg225929\r\ncontent-disposition: form-data;
name="os.arch"\r\n\r\nx86\r\n-----012AhbCfFg225929\r\ncontent-disposition:
form-data;
name="instructionProcessorVersion"\r\n\r\n01.019.0513\r\n-----012AhbCfFg225929\r\ncontent-disposition:
form-data;
name="User_ID"\r\n\r\ncustomer\r\n-----012AhbCfFg225929\r\ncontent-disposition:
form-data;
name="agentVersion"\r\n\r\n1.2.2\r\n-----012AhbCfFg225929\r\ncontent-disposition:
form-data;
name="java.version"\r\n\r\n1.3.1_03\r\n-----012AhbCfFg225929\r\ncontent-disposition:
form-data;
name="Order_Filename"\r\n\r\nTSTFILE.TST\r\n-----012AhbCfFg225929\r\ncontent-disposition:
form-data; name="Full_Filename"\r\n\r\nC:\\Program
Files\\Client\\.\\upload\\TSTFILE.TST\r\n-----012AhbCfFg225929\r\ncontent-disposition:
form-data;
name="instructionAction"\r\n\r\nspotOrderUpload\r\n-----012AhbCfFg225929\r\ncontent-disposition:
form-data;
name="File_Time"\r\n\r\n12:00:14\r\n-----012AhbCfFg225929\r\ncontent-disposition:
form-data;
name="File_Date"\r\n\r\n2006/02/07\r\n-----012AhbCfFg225929\r\ncontent-disposition:
form-data; name="os.name"\r\n\r\nWindows
2000\r\n-----012AhbCfFg225929\r\ncontent-disposition: form-data;
name="os.version"\r\n\r\n5.1\r\n-----012AhbCfFg225929\r\ncontent-disposition:
form-data;
name="Password"\r\n\r\npassword\r\n-----012AhbCfFg225929\r\ncontent-disposition:
form-data;
name="Size"\r\n\r\n961\r\n-----012AhbCfFg225929\r\ncontent-disposition:
form-data; name="file0"; filename="C:\\Program
Files\\Client\\.\\upload\\TSTFILE.TST"\r\nContent-Type:
application/pdf\r\n\r\n"SYS",1,11/11/2005 3:15:05
PM,TSTFILE.TST,1,2,,,,,,,,,,,,,,\r\n"CUS",21,"Joe
User",1,,,,,,,,,,,,,,,,\r\n"ADV",TEST,1,(CNC)
TEST,"TEST",TEST,"Joe","User",TST
TEST,"781-898-6500",,,DODGE,,,,,,"TEST","TEST"\r\n"ORD",0,0,,"3","1",,0,,,,,,,,,,,,\r\n"MED",2,"NUM-A","11/12/2005","11/30/2005",,"NUM
A",":30","P",1,"5",1048,0,"11/11/2005 5:00
PM","EST","1",,,,\r\n"MED",2,"NUM-B","11/12/2005","11/30/2005",,"NUM
B",":30","P",1,"5",1048,0,"11/11/2005 5:00
PM","EST","0",,,,\r\n"DES",1,"DEST-1",,,"0",,,,,,,,,,,,,,\r\n"DES",1,"DEST-2",,,"0",,,,,,,,,,,,,,\r\n"ORD",0,0,,"2","1",,0,,,,,,,,,,,,\r\n"MED",3,"SPOT-A","11/12/2005","11/30/2005",,"NUM
A",":30","P",1,"5",1048,0,"11/11/2005 5:00
PM","EST","0",,,,\r\n"MED",3,"NUM-B","11/12/2005","11/30/2005",,"NUM
B",":30","P",1,"5",1048,0,"11/11/2005 5:00
PM","EST","0",,,,\r\n"DES",1,"DEST-3",,,"0",,,,,,,,,,,,,,\r\n"DES",1,"DEST-4",,,"0",,,,,,,,,,,,,,\r\n"DES",1,"DEST-5",,,"0",,,,,,,,,,,,,,\r\n\r\n-----012AhbCfFg225929-----


I could write code to manually parse this string to extract the values
and the uploaded file content, but I was hoping that there was a more
straightforward way, and changing the existing Java client is not an
option Any suggestions would be appreciated.

Thanks in advance
 
J

jjouett

Also, I'm using .NET Framework 1.1. If anyone has a suggestion on the
best way to extract the data values from this request, I would be very
grateful.

Thanks in advance
 

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

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top