468,746 Members | 1,811 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

Using Hyperlink Control for file download

rh
Hi,

I am using a Hyperlink control that links to an Excel file. I would like
the "File Download" dialog box to appear instead of the Excel file
automatically opening within the browser.

What do I need to do? Thanks in advance.
Jan 18 '06 #1
1 2263
Instead of providing direct link to XLS file, let the link goto an ASP.Net
page. On that page, read your XLS file from file system and stream it to the
response stream. And set content-type header of response to "octet-stream".
That should do it.

Response.ContentType = "application/octet-stream";
Response.AddHeader("Content-Disposition", "attachment;
filename=myexcelfile.xls");
Response.WriteFile(fileObject);
Response.End();

"rh" <rh******@smci.com> wrote in message
news:eP*************@TK2MSFTNGP09.phx.gbl...
Hi,

I am using a Hyperlink control that links to an Excel file. I would like
the "File Download" dialog box to appear instead of the Excel file
automatically opening within the browser.

What do I need to do? Thanks in advance.

Jan 18 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Nathan Sokalski | last post: by
1 post views Thread by mjryan | last post: by
10 posts views Thread by David Thielen | last post: by
reply views Thread by Eugene Anthony | last post: by
20 posts views Thread by tshad | last post: by
3 posts views Thread by Nathan Sokalski | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.