471,070 Members | 1,349 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,070 software developers and data experts.

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 2314
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 leo001 | last post: by

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.