469,934 Members | 1,869 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,934 developers. It's quick & easy.

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 1637
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by peetm | last post: by
7 posts views Thread by Brian Paul | last post: by
4 posts views Thread by ACaunter | last post: by
4 posts views Thread by L. Scott M. | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.