473,408 Members | 2,734 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,408 software developers and data experts.

Double 'open' downloading a file in an ASP.NET page

I have a minor problem with a piece of code I have written to download
a CSV file in an ASP.NET application. It works fine except that if the
user presses the Open button on the IE6 download dialogue, then the
dialogue is presented a second time. Pressing the Open button again
works fine. Pressing the save button also works fine.

The code (c#) looks like:

if (Page.IsPostBack) {
Response.Clear();
Response.BufferOutput=true;
Response.ContentType="application/csv";
Response.AppendHeader("content-disposition","attachment;
filename=servicelist.csv");
Response.Cache.SetCacheability(HttpCacheability.No Cache);
Response.Cache.SetNoStore();
Response.Cache.SetExpires(DateTime.Now);
Response.Write(sb.ToString());
Response.End();
return;
}

Any assistance would be appreciated.

Keith
Nov 18 '05 #1
1 1339
Keith wrote:
I have a minor problem with a piece of code I have written to download
a CSV file in an ASP.NET application. It works fine except that if the
user presses the Open button on the IE6 download dialogue, then the
dialogue is presented a second time. Pressing the Open button again
works fine. Pressing the save button also works fine.
Response.ContentType="application/csv";
Response.AppendHeader("content-disposition","attachment;
filename=servicelist.csv");


Keith,
Try using "inline" rather than "attachment".

--

Thanks,
Carl Prothman
Microsoft ASP.NET MVP

Hire top-notch developers at
http://www.able-consulting.com
Nov 18 '05 #2

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

Similar topics

2
by: kevinm3574 | last post by:
So, I'm doing the following in a php script so that I can fire a download dialogue AND redirect the page (after clicking submit in a form). I'm doing it this way because of the problem with...
7
by: theyas | last post by:
How can I get my code to NOT display two "Open/Save/Cancel/More Info" dialog boxes when using the "Response.WriteFile" method to download a file to IE I've asked about this before and didn't get a...
4
by: Edwin Knoppert | last post by:
I have a problem with downloading a PDF by using the response object. A part of it: ..Response.Clear() ..Response.ContentType = sFileType ..Response.AppendHeader("Content-Disposition",...
6
by: Daniel | last post by:
Hi all, Can i open and edit the excel sheet on web page after downloading? After editing, i close the web page and the excel file auto upload to the server. Is it possible? I really struggling...
13
by: Daniel Walzenbach | last post by:
Hi, Imagine the following situation: I have an asp.net application which allows uploading files to a SQL Server 2000 database (Files are stored as type "images"). As a next step I would like to...
1
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call...
3
by: just.starting | last post by:
Hi, My dot net client downloads files and checks for any new files time to time. The server is apache2.0.53 server. So what happens is that my file download thing works fine if I dont try to call...
5
by: fniles | last post by:
We created an ActiveX control and marked it as safe for scripting using Implements IObjectSafety. We then created a CAB file and signed it using Verisign. We also created a license file (LPK file)...
1
by: pronerd | last post by:
Ok, I am looking for way to have a user download a file, and have it open the apprpreate client side application. For instance lets say a user is downloading an MS Word file. I want the user...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.