.NETGURU
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...
 
 




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification