Reliability of HTTP Get of ASP page

Discussion in 'ASP General' started by ross-mcm, Nov 14, 2007.

  1. ross-mcm

    ross-mcm Guest

    I have an app that gets a file from a web server. An ASP page is
    passed
    authenitication data (username, password) and a filename. The file is
    read
    and then output by the ASP page so the only response is the file I am
    requesting. The file I want to receive is XML with the major portion
    of it
    being a Base64-encoded block.

    I use the Indy component TidHTTP to get the file:

    HTTPClient.Request.ContentType := 'text/html';
    HTTPClient.Request.CacheControl := 'no-cache' ;
    Response.Text := HTTPClient.Get (TIdURI.URLEncode (URL)) ;

    Problem is that more often than not, the returned file contains
    errors. In
    a 200k file, 2 or 3 characters are often munged. Occasionally I
    manage to
    receive the file without errors. Small files are OK.

    How reliable is the HTTP protocol? Would it be more reliable to
    redirect to
    the target file from the ASP page. I say this because HTTP seems to
    have no
    problems getting .ZIP files or huge setup exe files.

    TIA,
    Ross
    ross-mcm, Nov 14, 2007
    #1
    1. Advertising

  2. "ross-mcm" <> wrote in message
    news:...
    > I have an app that gets a file from a web server. An ASP page is
    > passed
    > authenitication data (username, password) and a filename. The file is
    > read
    > and then output by the ASP page so the only response is the file I am
    > requesting. The file I want to receive is XML with the major portion
    > of it
    > being a Base64-encoded block.
    >
    > I use the Indy component TidHTTP to get the file:
    >
    > HTTPClient.Request.ContentType := 'text/html';
    > HTTPClient.Request.CacheControl := 'no-cache' ;
    > Response.Text := HTTPClient.Get (TIdURI.URLEncode (URL)) ;
    >
    > Problem is that more often than not, the returned file contains
    > errors. In
    > a 200k file, 2 or 3 characters are often munged. Occasionally I
    > manage to
    > receive the file without errors. Small files are OK.
    >
    > How reliable is the HTTP protocol? Would it be more reliable to
    > redirect to
    > the target file from the ASP page. I say this because HTTP seems to
    > have no
    > problems getting .ZIP files or huge setup exe files.


    HTTP is very reliable as you've allready identified. Your problem is
    likely to be found because characters encoding is not configured properly.
    We really need see the ASP code. Which characters are messup, characters
    found in other parts of the XML or in the Base64 part. A common error in
    sending XML from ASP is that the XML may be coming down as UTF-8 but the
    content-type header does not specify UTF-8.

    It would seem more sensible to fetch metadata if there is any as XML then
    fetch the file in its raw format. Base64 creates bloat.

    Another alternative if your client has the ability to access response
    headers and the amount of metadata is small is to simply respond with the
    file content and add any metadata need as custom headers to the response.


    --
    Anthony Jones - MVP ASP/ASP.NET
    Anthony Jones, Nov 15, 2007
    #2
    1. Advertising

  3. ross-mcm

    ross-mcm Guest

    I'm sure the ASP output is arriving OK. The ASP that send the file
    is:

    var TextStream = LoadFileFSO.OpenTextFile (UserFilePath +
    FileIDToLoad, ForReading) ;

    while (! TextStream.AtEndOfStream)
    {
    Line = TextStream.readline () ;
    Response.write (Line + "\r\n") ;
    }
    TextStream.Close () ;

    At the suggestion of Gambit, I assigned the reponse to a stream
    instead of a stringlist and that cured the problem. I have no idea
    why it would make any difference but it has.

    Ross McMillan
    ross-mcm, Nov 15, 2007
    #3
    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. Alan Cyment
    Replies:
    1
    Views:
    1,363
    Esmond Pitt
    Jan 29, 2004
  2. i_lk
    Replies:
    4
    Views:
    351
    Roedy Green
    Oct 11, 2005
  3. Somesh Bartakkay

    Reliability of venster+ctypes on win32

    Somesh Bartakkay, Apr 1, 2004, in forum: Python
    Replies:
    2
    Views:
    289
    Andrew MacIntyre
    Apr 2, 2004
  4. Ville Voipio

    Python reliability

    Ville Voipio, Oct 9, 2005, in forum: Python
    Replies:
    34
    Views:
    1,552
    Alex Martelli
    Oct 13, 2005
  5. Delaney, Timothy (Tim)
    Replies:
    20
    Views:
    863
    Patrick Down
    Oct 14, 2005
Loading...

Share This Page