473,394 Members | 1,843 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,394 software developers and data experts.

Response.WriteFile set page title

Hi

I am currently using the Response.WriteFile, to write a pdf file to a web
browser.
This method is working fine and helping me secure the files i need to.

However, when a new window is opened and a pdf displayed, the window takes
on the title like:
http://localhost/getfile.aspx?filename=userguide.pdf

Where I would prefer the title to be userguide.pdf.

I've used the Response.AppendHeader("Content-Disposition","inline;filename="
+ FileName); to change the file name if you choose to download it instead of
opening it.
I.e. when a user click the link that opens a new window to write the file,
they get an option to save or open.
If you click save, it saves with the correct name, but if you click open,
the page title is the same as the Url.

Is there a way to set this title.
I've tried hard coding the title into the aspx page, but it still changes to
the original url.
I've also tried Response.Write("<title>some title</title>"), which then
prevents the pdf from displaying properly and gives me what looks like
hexadecimal code (or a byte array - who knows)

So, if anyone knows a solution here, it will be much appreciated

Thanks

Grant
Nov 19 '05 #1
1 6650
Hello Grant,

I dont believe that this is possible due to security restrictions on the
browser. It will also not be possible (as you've seen) to send HTML and the
PDF data to the browser at the same time.

--
Matt Berther
http://www.mattberther.com
Hi

I am currently using the Response.WriteFile, to write a pdf file to a
web
browser.
This method is working fine and helping me secure the files i need to.
However, when a new window is opened and a pdf displayed, the window
takes
on the title like:
http://localhost/getfile.aspx?filename=userguide.pdf
Where I would prefer the title to be userguide.pdf.

I've used the
Response.AppendHeader("Content-Disposition","inline;filename="
+ FileName); to change the file name if you choose to download it
instead of
opening it.
I.e. when a user click the link that opens a new window to write the
file,
they get an option to save or open.
If you click save, it saves with the correct name, but if you click
open, the page title is the same as the Url.

Is there a way to set this title.
I've tried hard coding the title into the aspx page, but it still
changes to
the original url.
I've also tried Response.Write("<title>some title</title>"), which
then
prevents the pdf from displaying properly and gives me what looks like
hexadecimal code (or a byte array - who knows)
So, if anyone knows a solution here, it will be much appreciated

Thanks

Grant

Nov 19 '05 #2

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

Similar topics

6
by: Martin Knopp | last post by:
I have a site running under SSL. Works well so far but there is one ASPX page which returns a dynamically created PDF file using Response.WriteFile. When the browser requests this ASPX page via...
2
by: Carter | last post by:
i have a treeview on a webform (.aspx). when the user selects an appropriate node on the tvw. and clicks on a link button, i'm downloading a corresponding file to the client (from the server). so far...
0
by: ProJee | last post by:
Hi, Response.WriteFile (or Response.OutputStream.Write) finishes immediately, not after the file is completely downloaded. It finishes before (!) the user clicks the "Save" or "Open" browser...
2
by: David Union | last post by:
Hi. I'm posting this here because I don't know exactly what the best group is. This is for an aspx page with Visual Basic as the code-behind page. I am doing very simple code... in the middle...
8
by: Scott C. Reynolds | last post by:
I want to serve a PDF right to a web page (cannot link browser directly to PDF file). Stumbled across Response.WriteFile this morning. On my machine (XP Pro) this worked fine: private void...
3
by: jeffpriz | last post by:
I'm have a situation where I need to put a download link/button on a page, where the file to be downloaded does not exist on our webservers .... So I'm using Response.WriteFile (i've also tried...
1
by: Gert Albertse | last post by:
I'm reading a html file with response.writefile into a aspx web page. If I want to add a separate header or footer or anything else to the aspx web page, the response.writefile is the first part....
3
by: MJP | last post by:
I have a button which kicks off the generation of a report after which the file will be downloaded. The report generation can take a long time, so client side onclick event of the button also...
5
by: Khafancoder | last post by:
Hi guys, i am building a FileSharing website, i wanna allow users to be able using download managers such as DAP to download files from webserver but don't allow them to retrive files url......
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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.