473,785 Members | 2,489 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

file download dialog coming twice

i am using following code in button click... of asp.net code behind page

Response.Clear( ) 'clears the current output content from the buffer

Response.Append Header("Content-Disposition", _

"attachment ; filename=Add2Ca lendar.vbs")

Response.Append Header("Content-Length", mStream.Length. ToString())

Response.Conten tType = "applicatio n/download"

Response.Binary Write(mStream.T oArray())

Response.End()

but file download dialog comes twice if i select open at first time..

any solution to this
Dec 5 '05 #1
4 1759
try it without Response.Conten tType = "applicatio n/download" or use
Response.Conten tType = "applicatio n/octetstream"

--
Daniel Fisher(lennybac on)
http://www.lennybacon.com
"Vikram" <aa@aa> wrote in message
news:OK******** ********@TK2MSF TNGP15.phx.gbl. ..
i am using following code in button click... of asp.net code behind page

Response.Clear( ) 'clears the current output content from the buffer

Response.Append Header("Content-Disposition", _

"attachment ; filename=Add2Ca lendar.vbs")

Response.Append Header("Content-Length", mStream.Length. ToString())

Response.Conten tType = "applicatio n/download"

Response.Binary Write(mStream.T oArray())

Response.End()

but file download dialog comes twice if i select open at first time..

any solution to this

Dec 5 '05 #2
It didnt work after doing what u said.
But it worked when i removed "attachment " from
Content-Disposition part.

"Daniel Fisher(lennybac on)" <in**@lennybaco n.com> wrote in message
news:%2******** **********@TK2M SFTNGP09.phx.gb l...
try it without Response.Conten tType = "applicatio n/download" or use
Response.Conten tType = "applicatio n/octetstream"

--
Daniel Fisher(lennybac on)
http://www.lennybacon.com
"Vikram" <aa@aa> wrote in message
news:OK******** ********@TK2MSF TNGP15.phx.gbl. ..
i am using following code in button click... of asp.net code behind page

Response.Clear( ) 'clears the current output content from the buffer

Response.Append Header("Content-Disposition", _

"attachment ; filename=Add2Ca lendar.vbs")

Response.Append Header("Content-Length", mStream.Length. ToString())

Response.Conten tType = "applicatio n/download"

Response.Binary Write(mStream.T oArray())

Response.End()

but file download dialog comes twice if i select open at first time..

any solution to this


Dec 5 '05 #3
"Vikram" wrote ...
It didnt work after doing what u said.
But it worked when i removed "attachment " from
Content-Disposition part.


Give these a try:

' ContentType tells the browser what kind of file is coming.
' application/msword is a Microsoft Word document, eg:
' Response.Conten tType = "applicatio n/msword"

Response.Conten tType = "x-msdownload"

' Content-Disposition tells the browser how to handle the file, and what the
name
' of the file is. The "attachment " option tells the browser to open the Word
doc
' in a new instance of Microsoft Word, not in the browser Word plug-in

Response.AddHea der("Content-Disposition", "attachment;fil ename=""" +
fileName + """")
Response.AddHea der("Content-Length", New
System.IO.FileI nfo(FilePath).L ength.ToString( ))
HTH

Rob
Dec 5 '05 #4
Try setting the forms action as "get" and not as "post".
--
Thanks,
Rahul Soni

--->The secret to creativity is knowing how to hide your sources<---

"Vikram" wrote:
i am using following code in button click... of asp.net code behind page

Response.Clear( ) 'clears the current output content from the buffer

Response.Append Header("Content-Disposition", _

"attachment ; filename=Add2Ca lendar.vbs")

Response.Append Header("Content-Length", mStream.Length. ToString())

Response.Conten tType = "applicatio n/download"

Response.Binary Write(mStream.T oArray())

Response.End()

but file download dialog comes twice if i select open at first time..

any solution to this

Dec 5 '05 #5

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

Similar topics

5
5836
by: peetm | last post by:
I'd like to write to a log whenever a visitor to my site downloads a file. So, I'd like the link they click to be to a php 'page' that returns the file. Don't know how to do that! Side Question ... Presumably, the dialog that you see when you download a binary (asking for a 'Save As...' file name) is put up by your browser when it 'sees' non-text data coming back as a response? So, how would you download a text file - and cause...
1
2005
by: Navin | last post by:
hi, guys i am using the following code to force a file download dialog in asp Response.ContentType = "application/vnd.ms-excel" response.AddHeader "content-disposition","attachment; filename=" &" & StrFileName Now the it works fine in ie5.5 sp2 but no ie5.5 sp1 it prompts the user twice the open dialog box.
1
4934
by: Navin | last post by:
hi, guys i am using the following code to force a file download dialog in asp Response.ContentType = "application/vnd.ms-excel" response.AddHeader "content-disposition","attachment; filename=" &" & StrFileName Now the it works fine in ie5.5 sp2 but no ie5.5 sp1 it prompts the user twice the open dialog box.
7
2256
by: Brian Paul | last post by:
When a user clicks on a linkbutton on a page, i would like to render a printer-friendly version of the asp.net page and download it as an html attachment to the browser. The code below works great, with a few exceptions: 1) IE displays the FIle Download dialog box twice. (You have to click the Open button twice) 2) the encoding of the page is set to Western European (Windows) versus UTF-8. #1 above is just a pain. #2 above results in...
7
3706
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 satisfactory answer (check your browser) so now that I've had the time to set up a reasonable little test that I can post somewhere, I'll try again. The app I've written has three ASPX pages. One is a combined page which writes a little text...
6
3075
by: Divya | last post by:
Hi, I have a web page which generates a CSV file based on some user input. When this file is downloaded by the user, the file is being automatically converted to .xls. Any idea how I can prevent this? My code (snippet) - StreamWriter sw; if(File.Exists(filename))
4
1446
by: ACaunter | last post by:
Hi, when the download dialog box opens and i click save or open or cancel.. everything works fine.. but then it's stuck in memory or something, because nomatter what button, listbox, combobox, etc.. i click on next.. that download dialog box keeps coming up... why is that??? -- AdamPC@hotmail.com
4
3106
by: L. Scott M. | last post by:
I am invoking a file download using the following code: Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=" + downloadFile.Name); Response.AddHeader("Content-Length", downloadFile.Length.ToString()); Response.ContentType = "application/octet-stream";
7
7158
Curtis Rutland
by: Curtis Rutland | last post by:
Building A Silverlight (2.0) Multi-File Uploader All source code is C#. VB.NET source is coming soon. Note: This project requires Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1 and Silverlight 2.0. To get these tools please visit this page Get Started : The Official Microsoft Silverlight Site and follow Step 1. Occasionally you find the need to have users upload multiple files at once. You could use multiple FileUpload...
0
9485
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10356
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10161
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10098
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9958
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8986
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6743
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5523
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3662
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.