469,138 Members | 1,239 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,138 developers. It's quick & easy.

Open/Save dialog

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


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
0 2685

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Venkat | last post: by
3 posts views Thread by Newbie | last post: by
2 posts views Thread by Pat Richey | last post: by
4 posts views Thread by John | last post: by
2 posts views Thread by Jonathan Trevor | last post: by
6 posts views Thread by Michael Groeger | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by zhoujie | last post: by
1 post views Thread by Mortomer39 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.