473,396 Members | 2,011 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Displaying File name on a fetcher page

Hi all,

I have a file retrieved from a database and I want to return it over a web
page.

I currently have an ASPX page (Download.aspx) with code similar to the
following in Page_Load():

...
string file = Request["file"];byte[] fileData = this.getFile(file); // this
fetches the file's data, to be writtenResponse.ContentType =
"application/octet-stream"
Response.AppendHeader("Content-Disposition", "filename=" & file);
Response.AppendHeader("Content-Length",
fileData.Length);Response.BinaryWrite(file);Respon se.Flush();...I can invoke
this as http://localhost/FetchFile/Download....MyFile.docThis code
works perfectly and returns the file with a download prompt.The problem that
I do have, is that the page shows it's own filename as the title.While this
is not an issue for download links, this page is also indexed, and the
results display a meaningless "Download.aspx" as the result.Adding
"Response.Write("<TITLE>" + file + "</TITLE");also doesn't work, as it gets
mixed up with the file contents, and basically corrupts it.I also tried
setting the page as the default page for the site, so files can be
downloaded ashttp://localhost/FetchFile/?file=MyFile.doc, but then it
returns "FetchFile" as the title.Is there a way of forcing the page's title
to be something I want?I'd appreciate any insight on this.Thanks in
advance,Rukmal.
Nov 18 '05 #1
1 1333
"Rukmal Fernando" <ru*************@yahoo.com> wrote in message
news:O0**************@TK2MSFTNGP12.phx.gbl...
Hi all,

I have a file retrieved from a database and I want to return it over a web
page.

I currently have an ASPX page (Download.aspx) with code similar to the
following in Page_Load():

...
string file = Request["file"];byte[] fileData = this.getFile(file); // this fetches the file's data, to be writtenResponse.ContentType =
"application/octet-stream"
Response.AppendHeader("Content-Disposition", "filename=" & file);
Response.AppendHeader("Content-Length",
fileData.Length);Response.BinaryWrite(file);Respon se.Flush();...I can invoke this as http://localhost/FetchFile/Download....MyFile.docThis code
works perfectly and returns the file with a download prompt.The problem that I do have, is that the page shows it's own filename as the title.While this is not an issue for download links, this page is also indexed, and the
results display a meaningless "Download.aspx" as the result.Adding
"Response.Write("<TITLE>" + file + "</TITLE");also doesn't work, as it gets mixed up with the file contents, and basically corrupts it.I also tried
setting the page as the default page for the site, so files can be
downloaded ashttp://localhost/FetchFile/?file=MyFile.doc, but then it
returns "FetchFile" as the title.Is there a way of forcing the page's title to be something I want?I'd appreciate any insight on this.Thanks in
advance,Rukmal.


What happens if you use:

Content-Disposition: attachment; filename=<file>

?
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Waguih Boctor | last post by:
Hi, I have a number of ASP pages where some JPGs and GIFs are displaying in the browser and some are not. I have included an excerpt from the HTML below. In this example, the gif file at the...
1
by: Mark ??;-\) | last post by:
I would like to display a listing of files on a web page as follows: If there is only one file: display the section name and then display the current file. If there is more than one file (for...
5
by: Tomaz Koritnik | last post by:
Hi I have many short HTML files stored in a binary stream storage to display descriptions for various items in application. HTML would be display inside application using some .NET control or...
1
by: | last post by:
Thanks for your help. I wish I could do that; however our IT department is ... Zelis ... About security; it's a school district, so lots of confidential data, etc, etc (their reason). Oh well,...
1
by: j7.henry | last post by:
I am trying to pull specific data that is in a comma delimited file into a web page. So if my comma delimited file looks like: Name,Address,Zip Fred,123 Elm,66666 Mike,23 Jump,11111 I would...
4
by: adamwolf1965 | last post by:
On the page http://www.franklincar.org/index.html (which I did not build), some Firefox users are reporting that the "Franklin Vintage Photo Book" image towards the middle of the page (right below...
38
by: ted | last post by:
I have an old link that was widely distributed. I would now like to put a link on that old page that will go to a new page without displaying anything.
2
by: GoodMan | last post by:
Hello, I've been Googling around the internet oceans in search of a piece of code that has a similar functionality as the Digg image fetcher. I've always wondered how this thing works exactly. ...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.