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.