ASP download filename default to ASP page name on IE 6 SP2 and IIS

G

Guest

We are experiencing an issue with the Content Disposition header, IE 6.0 SP2
on Windows XP, and Windows Server 2003 running IIS 6. We have recently
upgraded our servers to Windows Server 2003, which broke our applications
because of this issue. These are primarily intranet applications, and our
users are all using IE 6.0 SP2 on Windows XP. It appears that the filename
parameter in this header is ignored by IE 6.0 SP2. We have the following
code in an ASP page called MatchingADO.ASP:

with Response
.ContentType = "application/octet-stream"
.AddHeader "Content-Disposition", "attachment;filename=Call.dat"
end with
If rs.state = 1 Then
If not rs.EOF Then
Response.write rs(2)
End If
End If

We have some fairly equivalent code in an ASP.NET page code behind called
ViewResume.aspx.vb

Response.AppendHeader("content-disposition",
"filename=" _
&
dtResume.Rows(0).Item("attachment_file_name").ToString)
Response.ContentType =
dtResume.Rows(0).Item("content_type").ToString

Response.OutputStream.Write(CType(dtResume.Rows(0).Item("attachment_file"),
Byte()), 0, CType(dtResume.Rows(0).Item("content_size"), Int32))

The datatable dtResume has information on the filename and type of resume
(doc, pdf, txt, etc.)

The problem we are having, in both the .NET code and the classic ASP code,
is that the filename info is ignored in the "Save or Open" dialog. The ASP
code gives the default save filename as "MatchingADO.ASP" and the
ViewResume.aspx.vb code gives the save filename as "ViewResume.DOC",
"ViewResume.PDF", or "ViewResume.ASPX" depending on the content type (Word,
PDF, or text). Upon further investigation I find that changing the content
type in both ASP and ASP.NET changes the file extension (.DOC, .PDF, etc) but
not the name itself, which is always the name of the ASP or ASPX page.

Also upon further examination I found the following to be true:
- This problem only occurs on IE 6.0 SP2 and IIS 6.0 Serving the same page
from a Windows 2000 Server or Windows XP Professional host (with IIS 5) gives
the filename supplied in the Content Disposition header.
- We have one user still running IE 6.0 SP1 and serving the page from IIS
6.0 to this browser works as expected, giving the filename supplied in the
Content Disposition header.
- FireFox 1.x works as expected when the page is served from IIS 6.0, giving
the filename supplied in the Content Disposition header.
- Attempting to debug the problem with IE 6.0 SP2 using Microsoft's HTTP
debugging tool, Fiddler, makes the problem go away (the filename supplied in
the content disposition header is given, and the headers shown in Fiddler are
correct.) I believe this is because Fiddler acts as a proxy and is somehow
scrubbing my HTTP headers.
- A common solution given is found at
http://www.aspfaq.com/show.asp?id=2129. I tried each of the 6 formats of the
header given (adding a “;†at the end of the filename, using “inline†instead
of “attachmentâ€, etc.) without success.
- As I mentioned earlier I have tried changing the content type to
application/octet-stream, text/plain, text/html, application/msword, etc. and
the extension will change but not the filename, which is still the name of
the ASP or ASPX page.
- The content of the saved file is always correct, regardless of the content
type or filename.

I have read every other post I can find both here on MSDN and on the web and
tried every solution given without success. Can you please help me resolve
this issue, or if it is a bug in IE 6.0 SP2 (this looks very similar to the
bug in IE 5.5 that was later corrected) can you please suggest a workaround?
This has become a critical issue for us.

Thank you for any help you can give. It is greatly appreciated. If you
need more information, please let me know.

Thanks,

Ron Dombroski
Systems Integration Analyst, Sr.
Idaho Department of Commerce and Labor
 
P

PJ

I can tell you that I had this same issue with IE 5 on Mac OS 9.2. I was
never able to get that particular user agent to recognize the filename in
the Content-Disposition header either.

Eventually, I changed my download scheme altogether. All download links
include a directory in the path that is a guid followed by the actual
filename of the file to be downloaded. This directory does not exist so a
404 condition occurrs. In IIS, I mapped 404's to a custom file called
"main.download". In asp.net, I created a handler for files with the
extension ".download" and unchecked the "Check that file exists." The
handler checks for the existance of a guid directory in the request path and
sends a 404 if one is not found. If one is found, it uses the guid as a key
to the contextual information for the download stored in the webcache and
chunks out the file to the response stream.

~Paul
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top