471,893 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,893 software developers and data experts.

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

http://support.microsoft.com/default...b;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
Response.Clear()

' 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
Response.Write(sDataToSave)

' 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
Response.End()
Nov 18 '05 #1
0 2811

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
reply views Thread by YellowAndGreen | last post: by
reply views Thread by zermasroor | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.