Incorrect http form parsing problem....

D

Dan Corkum

Good morning. I am working on an issue that is just baffling me. I have
developed an .aspx page that receives an http form post that has a "file"
attribute.

When I do testing with a test post page, everything functions properly. When
the actual customer does the post, the attribute following the "file"
attribute is concatenated to the file itself. When I execute the
HttpPostedFile.SaveAs(), the resulting file is what is sent Plus the
following form attribute. This following attribute is not in any Collection
from the Request object.

Here is how I log the http post;

//Log the post sent
buf = new byte[Request.InputStream.Length];
Request.InputStream.Read(buf, 0, buf.Length);
char[] asciiChars = new char[Encoding.ASCII.GetCharCount(buf, 0, buf.Length)];
Encoding.ASCII.GetChars(buf, 0, buf.Length, asciiChars, 0);
FileUtils.getInstance().Log( "Stream:[" + new String(asciiChars) + "]");

This is the resulting log;

--------------CaminusWebExchange32MultiPartPOSTBoundary1106091985
Content-disposition: form-data; name="from"

030353283
--------------CaminusWebExchange32MultiPartPOSTBoundary1106091985
Content-disposition: form-data; name="to"

TERMOMEXI
--------------CaminusWebExchange32MultiPartPOSTBoundary1106091985
Content-disposition: form-data; name="input-format"

x12
--------------CaminusWebExchange32MultiPartPOSTBoundary1106091985
Content-disposition: form-data; name="input-data";
filename="ProcessLog.14404.log"
Content-Type: application/octet-stream

ISA*00* *00* *01*030353283 *01*TERMOMEXI
*050118*1546*U*00304*000014407*1*T*~
GS*CA*G865SQTS*TERMOMEXISQTS*050118*1546*000014407*X*003040
ST*865*000014407
BCA*00**1***050118
DTM*102*****DT*200501181546
N1*78**1*TERMOMEXI
N1*SJ**1*030353283
POC*-1*OC******CR*A004F1*MN*T
DTM*007*****RD8*20040930-20040930
SLN*1**I*20000.000000*BZ
SI*AP*TT*01*PG*Default*UK*N/A*R2*1*R3*1*DK*N/A
PO3*ZZ*****19830.000000*BZ
N1*M2**29*301068
N1*MQ**29*336408
N1*DW**1*N/A
N1*US**1*N/A
SLN*2**I*15000.000000*BZ
SI*AP*TT*01*PG*Default*UK*N/A*R2*1*R3*1*DK*N/A
PO3*ZZ*****14872.000000*BZ
N1*M2**29*EHR MC
N1*MQ**29*336408
N1*DW**1*N/A
N1*US**1*N/A
POC*-1*OC******CR*A004F1*MN*U
DTM*007*****RD8*20040930-20040930
SLN*1**I*34702.000000*BZ
SI*AP*TT*01*PG*Default*UK*N/A*R3*1*DK*TEXTEST*RR*N/A
N1*MQ**29*336408
N1*DW**1*TERMOMEXI
N1*US**1*N/A
SLN*2**I*15000.000000*BZ
SI*AP*TT*01*PG*Default*UK*A009MC*R2*1*DK*N/A*RR*N/A
N1*M2**29*EHR MC
N1*DW**1*N/A
N1*US**1*067271981
SLN*3**I*20000.000000*BZ
SI*AP*TT*01*PG*Default*UK*97HH*R2*1*DK*N/A*RR*N/A
N1*M2**29*301068
N1*DW**1*N/A
N1*US**1*067271981
CTT*2
SE*000000040*000014407
GE*1*000014407
IEA*1*000014407
--------------CaminusWebExchange32MultiPartPOSTBoundary1106091985
Content-disposition: form-data; name="transaction-set"

G865SQTS
--------------CaminusWebExchange32MultiPartPOSTBoundary1106091985
Content-disposition: form-data; name="batch-id"

23
--------------CaminusWebExchange32MultiPartPOSTBoundary1106091985--



But this is the file that is saved when I execute HttpPostedFile.SaveAs();

ISA*00* *00* *01*030353283 *01*TERMOMEXI
*050118*1546*U*00304*000014407*1*T*~
GS*CA*G865SQTS*TERMOMEXISQTS*050118*1546*000014407*X*003040
ST*865*000014407
BCA*00**1***050118
DTM*102*****DT*200501181546
N1*78**1*TERMOMEXI
N1*SJ**1*030353283
POC*-1*OC******CR*A004F1*MN*T
DTM*007*****RD8*20040930-20040930
SLN*1**I*20000.000000*BZ
SI*AP*TT*01*PG*Default*UK*N/A*R2*1*R3*1*DK*N/A
PO3*ZZ*****19830.000000*BZ
N1*M2**29*301068
N1*MQ**29*336408
N1*DW**1*N/A
N1*US**1*N/A
SLN*2**I*15000.000000*BZ
SI*AP*TT*01*PG*Default*UK*N/A*R2*1*R3*1*DK*N/A
PO3*ZZ*****14872.000000*BZ
N1*M2**29*EHR MC
N1*MQ**29*336408
N1*DW**1*N/A
N1*US**1*N/A
POC*-1*OC******CR*A004F1*MN*U
DTM*007*****RD8*20040930-20040930
SLN*1**I*34702.000000*BZ
SI*AP*TT*01*PG*Default*UK*N/A*R3*1*DK*TEXTEST*RR*N/A
N1*MQ**29*336408
N1*DW**1*TERMOMEXI
N1*US**1*N/A
SLN*2**I*15000.000000*BZ
SI*AP*TT*01*PG*Default*UK*A009MC*R2*1*DK*N/A*RR*N/A
N1*M2**29*EHR MC
N1*DW**1*N/A
N1*US**1*067271981
SLN*3**I*20000.000000*BZ
SI*AP*TT*01*PG*Default*UK*97HH*R2*1*DK*N/A*RR*N/A
N1*M2**29*301068
N1*DW**1*N/A
N1*US**1*067271981
CTT*2
SE*000000040*000014407
GE*1*000014407
IEA*1*000014407
--------------CaminusWebExchange32MultiPartPOSTBoundary1106091985
Content-disposition: form-data; name="transaction-set"

G865SQTS


Notice that the form element "transaction-set" is concatenated to the file.
This only occurs with the user's post, but not with my .aspx test post page.
Any ideas would help.

Dan Corkum
 
B

Bob Barrows [MVP]

Dan said:
Good morning. I am working on an issue that is just baffling me. I
have developed an .aspx page

There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-savvy person here who can
answer your question, you can eliminate the luck factor by posting your
question to a newsgroup where the dotnet-savvy people hang out. I suggest
microsoft.public.dotnet.framework.aspnet.

HTH,
Bob Barrows
 

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

Similar Threads

http form parsing problem... 0
action_page.php form 2

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top