Response.WriteFile set page title

G

Grant Merwitz

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
 
M

Matt Berther

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,733
Messages
2,569,440
Members
44,830
Latest member
ZADIva7383

Latest Threads

Top