Response Filename for Download
Messages   Related Types
This message was discovered on ASPFriends.com 'ngfx-msoffice' list.


Chuck Peper
-- Moved from [aspngfreeforall] to [ngfx-msoffice] by James Avery <Click here to reveal e-mail address> --

I am sending an excel file to the browser using this technique

Response.ContentType ="application/vnd.ms-excel"
Response.OutputStream.Write(bytearray, 0, bytearray.Length)

Unfortunately the filname on the browser is allways the blah.aspx
filename. Is there anyway to change it, so it is filename.xls?

Note I am streaming the file from a database. I know I could save the
file to the server and then response.redirect to the server filename.
However, I would like to avoid the problems with saving/deleting files
on the server.

Reply to this message...
 
    
Herring, Anthony Kyle
Chuck,

Try this. Works for me.

Response.AddHeader "Content-Disposition", "inline;filename=YourFile.xls"

-Tony

-----Original Message-----
From: Chuck Peper [mailto:Click here to reveal e-mail address]
Sent: Thursday, May 16, 2002 3:58 PM
To: ngfx-msoffice
Subject: [ngfx-msoffice] Response Filename for Download

-- Moved from [aspngfreeforall] to [ngfx-msoffice] by James Avery
<Click here to reveal e-mail address> --

I am sending an excel file to the browser using this technique

Response.ContentType ="application/vnd.ms-excel"
Response.OutputStream.Write(bytearray, 0, bytearray.Length)

Unfortunately the filname on the browser is allways the blah.aspx
filename. Is there anyway to change it, so it is filename.xls?

Note I am streaming the file from a database. I know I could save the
file to the server and then response.redirect to the server filename.
However, I would like to avoid the problems with saving/deleting files
on the server.
| [ngfx-msoffice] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-msoffice.asp = JOIN/QUIT

Reply to this message...
 
    
Chris Emerson
I have a similar issue - I'm having a problem compiling a dynamic webform
page into a word doc download. I'm assuming I am not using the right syntax
of response.binarywrite (although I may be way off). Currently I'm doing
something like this...

[Original message clipped]


It usually just passes straight through this w/out sending any file to the
user.
I remember in ASP classic, all I had to do was this line and it worked like
a charm:
>> Response.ContentType = "application/" & Request("format")

Any ideas?

-----Original Message-----
From: Herring, Anthony Kyle [mailto:Click here to reveal e-mail address]
Sent: Friday, May 17, 2002 9:05 AM
To: ngfx-msoffice
Subject: [ngfx-msoffice] RE: Response Filename for Download

Chuck,

Try this. Works for me.

Response.AddHeader "Content-Disposition", "inline;filename=YourFile.xls"

-Tony

-----Original Message-----
From: Chuck Peper [mailto:Click here to reveal e-mail address]
Sent: Thursday, May 16, 2002 3:58 PM
To: ngfx-msoffice
Subject: [ngfx-msoffice] Response Filename for Download

-- Moved from [aspngfreeforall] to [ngfx-msoffice] by James Avery
<Click here to reveal e-mail address> --

I am sending an excel file to the browser using this technique

Response.ContentType ="application/vnd.ms-excel"
Response.OutputStream.Write(bytearray, 0, bytearray.Length)

Unfortunately the filname on the browser is allways the blah.aspx
filename. Is there anyway to change it, so it is filename.xls?

Note I am streaming the file from a database. I know I could save the
file to the server and then response.redirect to the server filename.
However, I would like to avoid the problems with saving/deleting files
on the server.
| [ngfx-msoffice] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-msoffice.asp = JOIN/QUIT

| [ngfx-msoffice] member Click here to reveal e-mail address = YOUR ID
| http://www.aspfriends.com/aspfriends/ngfx-msoffice.asp = JOIN/QUIT

Reply to this message...
 
 




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com