By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,677 Members | 1,094 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,677 IT Pros & Developers. It's quick & easy.

Open/Save dialog

P: n/a
Hi there,

I have an aspx page that allows users to enter several parameters using drop downs and text boxes. The users then press a button that produces an extract based on the parameters they entered. When this button is pressed and extract is prduced and IE's standard Open/Save dialog should popup so they can navigate to the directory to save the extract in, or if they want, they can choose to open and view the extract without saving it.

To make the Open/Save dialog popup, my code-behind uses the Response object and appends headers and sets the content type. So far so good. When the extract is a text file named using the .txt file extension, everything works as expected. However, when the extract is a comma separated file named using the .csv extension, the Open/Save dialog pops up TWICE when the Open button is pressed in the dialog.

This seems to be related to this known bug in IE:
Microsoft Knowledge Base Article - 238588 - Internet Explorer Prompts the User with Two Open or Save Dialog Boxes;EN-US;238588

Does anyone know a work around? And why does this problem only occur with .csv files and not with .txt files?

Here is what my code-behind is doing:

' Turn on buffering if needed
If Not Response.BufferOutput Then
Response.BufferOutput = True
End If

' Clear the current output content from the buffer

' Add the header that forces the Download/SaveAs dialog to be displayed and
' specifies the default filename for the dialog
Response.AppendHeader("Content-Disposition", "attachment; filename=" & sFileName)

' Add the header that specifies the file size, so that the browser
' can show the download progress
Response.AppendHeader("Content-Length", sDataToSave.Length.ToString())

' Specify that the response is a stream that cannot be read by the client
' and must be downloaded
Response.ContentType = "application/octet-stream"

' Send the file stream to the client

' Send data in buffer and stop the execution of this page to ensure we only send
' the data we want and not other parts of this page
Nov 18 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.