Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HTTP Headers being dropped by upload page

Status
Not open for further replies.

Kavius

Programmer
Apr 11, 2002
322
CA
I have an asp page that checks that a user is logged in, and have the permissions to view a requested file.

On the local network, the server transfers the data correctly and there are no problems. However, when I send the file over the internet it appears that the HTTP headers are being stripped. This results in the file not being able to be interpreted correctly by the browser. Does anyone know what could cause this?

Under Firefox, I see the data displayed as text (very interesting for XLS files); and under IE I receive a series of error messages:
[tt]
1. Could not open '2. Microsoft Excel cannot access the file '...'
3. Internet Explorer was not able to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later.
[/tt]
Just incase anyone is confused as to what I am talking about, here is the signifigant code on the server:
[tt]
Response.Clear

set stm = server.CreateObject("ADODB.Stream")
stm.Mode = 3 'readwrite
stm.Type = 1 'binary
stm.Open
stm.LoadFromFile strCopyFile
with response
.AddHeader "cache-control","no-cache"
.AddHeader "content-type", mime
.AddHeader "content-length",stm.Size
.AddHeader "content-disposition","inline; filename=" & strFilename
.BinaryWrite stm.Read(stm.Size)
end with
stm.Close
set stm = nothing

Response.End
[/tt]
 
try this instead:

.AddHeader "cache-control","must revalidate"


-DNG
 
oops i meant...

.AddHeader "cache-control","no-cache,must revalidate"

-DNG
 
The best I can tell its not with the caching. I did try that with no effect.

It appears to be with the "AddHeader" function. I got it to partially work by changing the AddHeader to:
[tt]
.CacheControl = "no-cache,must revalidate"
.ContentType = mime
[/tt]
instead of
[tt]
.AddHeader "cache-control","no-cache"
.AddHeader "content-type", mime
[/tt]
This worked better, I now receive the files if I am on the intranet, but don't receive them on the internet. The one thing I find very worrying is that when I check the headers returned to the browser, I do not receive the size, or filename. In other words the browser is receiving the headers that are set through the response object, but not receiving ones that use the AddHeader method.
 
Alright, this is interesting. I don't know if I was reading it wrong before, but these are my new headers:
[tt]
HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0
Date: Thu, 18 Aug 2005 21:44:11 GMT
X-Powered-By: ASP.NET
Content-Disposition: inline; filename=t.pdf
Content-type: application/pdf
WARNING: Error message!
Connection: Keep-Alive
Content-Type: text/html
Cache-control: private
Content-Length: 53606
[/tt]
The last header I set is "WARNING: Error Message!". That means that I am getting the correct information out, but IIS is kindly overwriting them (at least on my IIS 5 test, I still think my IIS 6 test did not even accept my "AddHeader" at all).

Any other ideas? This is getting really frustrating.
 
Total Red Herring.

It turns out that I can view the site under Firefox, I can't view it under IE6. After further investigation I came across a couple of articles related to similar problems for IE5 and IE6 sp1. Both describe similar symptoms being related to SSL and caching. Unfortunately, I am running IE6 sp2, so this shouldn't apply to me. I will continue reading.


As it stands now:
[tt]
Fails: IE6/HTTPS
Works: IE6/HTTP
Works: Firefox/HTTPS
Works: Firefox/HTTP
[/tt]
 
Always do... Or at least try to... well, sometimes I do... err, never mind :)

-Kavius-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top