Asp Classic Write PDf and keep filename when printed

rrr

New Member
I'm trying to write a pdf file to the browser and when the client print the pdf the filename sent to the printer is the name of the file. But now i'm getting the name of the asp page sent to the browser "loadfile.asp"Because I can't put a title in my page when i'm using \[code\]Response.ContentType = "application/pdf"\[/code\], I've added a page that do a \[code\]server.Transfer\[/code\].But everytime the code pass trought the \[code\]Response.ContentType = "application/pdf"\[/code\] the title get blanked.So here's my code : First Page : \[code\]<html><head><title> <%= Request.QueryString("File") & ".PDF" %></title></head><body><%Server.Transfer "loadfileAfter.asp"%></body></html>\[/code\]Here's the Second Page (loadfileAfter.asp) : \[code\] Response.ContentType = "application/pdf" Response.AddHeader "content-disposition", "Filename=" & Request.QueryString("File") & ".PDF" Const adTypeBinary = 1 strFilePath = "D:\" & Request.QueryString("File") & ".PDF" 'This is the path to the file on disk. Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open objStream.Type = adTypeBinary objStream.LoadFromFile strFilePath Response.BinaryWrite objStream.Read objStream.Close Set objStream = Nothing\[/code\]I tought that this line would help : \[code\]Response.AddHeader "content-disposition", "Filename=" & Request.QueryString("File") & ".PDF"\[/code\]But it did not change a thing.Thanks for your help
 
Top