|
it
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Reliability of HTTP Get of ASP page
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
Show quote
"ross-mcm" <ross***@gmail.com> wrote in message HTTP is very reliable as you've allready identified. Your problem isnews:1195075391.005371.29310@t8g2000prg.googlegroups.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. 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 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
Other interesting topics
|
|||||||||||||||||||||||