Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > Reliability of HTTP Get of ASP page

Reply
Thread Tools

Reliability of HTTP Get of ASP page

 
 
ross-mcm
Guest
Posts: n/a
 
      11-14-2007
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

 
Reply With Quote
 
 
 
 
Anthony Jones
Guest
Posts: n/a
 
      11-15-2007
"ross-mcm" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) ps.com...
> 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


 
Reply With Quote
 
 
 
 
ross-mcm
Guest
Posts: n/a
 
      11-15-2007
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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Http post and http get n3d!m Python 2 02-06-2012 09:18 PM
HTTP SOAP/HTTP GET/HTTP POST milan_9211 Software 0 01-10-2011 02:10 PM
Can't get 32 bit reliability on 64 bit platform Howard Woodard Windows 64bit 1 11-18-2008 03:34 AM
Can I change the response URL to http://server/page.XLS instead of http://server/page.ASPX ? guillermojco@gmail.com ASP .Net 3 04-26-2007 04:49 AM
HTTP GET vs HTTP POST protocol serge calderara ASP .Net Web Services 1 11-04-2005 01:27 PM



Advertisments