Incorrect http form parsing problem....

Discussion in 'ASP General' started by Dan Corkum, Jan 20, 2005.

  1. Dan Corkum

    Dan Corkum Guest

    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
     
    Dan Corkum, Jan 20, 2005
    #1
    1. Advertising

  2. Dan Corkum wrote:
    > 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
    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.
     
    Bob Barrows [MVP], Jan 20, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?RGFuIENvcmt1bQ==?=

    http form parsing problem...

    =?Utf-8?B?RGFuIENvcmt1bQ==?=, Jan 20, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    325
    =?Utf-8?B?RGFuIENvcmt1bQ==?=
    Jan 20, 2005
  2. Dario Di Bella

    Incorrect parsing of special characters

    Dario Di Bella, Jun 17, 2004, in forum: Java
    Replies:
    3
    Views:
    431
    Dario Di Bella
    Jun 18, 2004
  3. Dario Di Bella

    Incorrect parsing of special characters

    Dario Di Bella, Jun 17, 2004, in forum: XML
    Replies:
    6
    Views:
    1,275
    Dario Di Bella
    Jun 18, 2004
  4. Sullivan WxPyQtKinter
    Replies:
    1
    Views:
    412
    Tim Roberts
    Apr 7, 2006
  5. fochie
    Replies:
    0
    Views:
    319
    fochie
    Feb 1, 2005
Loading...

Share This Page