473,399 Members | 4,192 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,399 software developers and data experts.

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.AppendHeader("Content-Disposition", _

"attachment; filename=Add2Calendar.vbs")

Response.AppendHeader("Content-Length", mStream.Length.ToString())

Response.ContentType = "application/download"

Response.BinaryWrite(mStream.ToArray())

Response.End()

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

any solution to this
Dec 5 '05 #1
4 1738
try it without Response.ContentType = "application/download" or use
Response.ContentType = "application/octetstream"

--
Daniel Fisher(lennybacon)
http://www.lennybacon.com
"Vikram" <aa@aa> wrote in message
news:OK****************@TK2MSFTNGP15.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.AppendHeader("Content-Disposition", _

"attachment; filename=Add2Calendar.vbs")

Response.AppendHeader("Content-Length", mStream.Length.ToString())

Response.ContentType = "application/download"

Response.BinaryWrite(mStream.ToArray())

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(lennybacon)" <in**@lennybacon.com> wrote in message
news:%2******************@TK2MSFTNGP09.phx.gbl...
try it without Response.ContentType = "application/download" or use
Response.ContentType = "application/octetstream"

--
Daniel Fisher(lennybacon)
http://www.lennybacon.com
"Vikram" <aa@aa> wrote in message
news:OK****************@TK2MSFTNGP15.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.AppendHeader("Content-Disposition", _

"attachment; filename=Add2Calendar.vbs")

Response.AppendHeader("Content-Length", mStream.Length.ToString())

Response.ContentType = "application/download"

Response.BinaryWrite(mStream.ToArray())

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.ContentType = "application/msword"

Response.ContentType = "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.AddHeader("Content-Disposition", "attachment;filename=""" +
fileName + """")
Response.AddHeader("Content-Length", New
System.IO.FileInfo(FilePath).Length.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.AppendHeader("Content-Disposition", _

"attachment; filename=Add2Calendar.vbs")

Response.AppendHeader("Content-Length", mStream.Length.ToString())

Response.ContentType = "application/download"

Response.BinaryWrite(mStream.ToArray())

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
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...
1
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="...
1
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="...
7
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,...
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...
6
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...
4
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,...
4
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);...
7
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...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...
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
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...
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.