473,226 Members | 1,220 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,226 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


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 2929

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: Venkat | last post by:
Hi, I have an file1.exe file stored at some physical location say C:\Test\file1.exe. I created a virtual folder say MyFolder pointing to my physical folder(C:\Test\). I wrote this piece of...
by: Newbie | last post by:
I am trying to get the save/open dialog figured out. I am able open the save dialog but when I put in a file name (whatever.txt) and save the file does save with the name but it is blank. Below...
by: Pat Richey | last post by:
i'm trying to make an open and a save file dialog that allows you to open/save various formats, but when you change the extension you want to filter the file list disappears until you leave the...
by: John | last post by:
Hi, I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file HyperLink1.text = "Download"...
by: Jonathan Trevor | last post by:
Hi, For the last couple of releases of a product we're developing we've been running to very wierd behavior from IE and our ASP.NET web application which serves up various types of files and I'm...
by: Dorte | last post by:
Hi, I am using the code below to stream a CSV file with the response object. Dim FileName As String = "Test.csv" With Web.HttpContext.Current.Response ...
by: Michael Groeger | last post by:
Hi, I have an aspx page which generates an excel document and transfers it to the browser as attachment. Normally, once the document is transferred the open save dialog prompts to open or save...
by: rdemyan | last post by:
I'm using code from the following web page to open the API Browse Folder dialog http://www.mvps.org/access/api/api0002.htm It all works fine. But if the dialog box is open and the user closes...
by: BusyBoy | last post by:
Hi All I am using two aspx pages The first aspx page loads the second page in a popup window. The second aspx page has no html and I change its content type to download a particular file. ...
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

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.