Click here to Skip to main content
15,910,277 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Friends,


Please help me to find out the possible way to hide the PDF source URL.I want to just show the content of PDF not the source URL of the PDF.For Example, PDF located at d:/common/work/sample.pdf. Normally it shows http://localhost/myproj/common/work/sample.pdf

I want want to show the above URL to the user.I want to simply Show the default URl like: http://localhost/myproj


Please help me to find out the most reliable way.


Thanks.
Posted

1 solution

Try this :

string filename = "attachment; filename=d:/common/work/sample.pdf";


    Response.Clear();
    Response.ContentType = "application/pdf";
    Response.AddHeader("content-disposition", filename);
    Response.BinaryWrite(bytes);
    Response.Flush();
    Response.End();
 
Share this answer
 
v2
Comments
Rupanjana 2-Nov-11 6:45am    
If the Url is http://www.myApp.co/common/work/sample.pdf
then what should I take as a filename.

then the solution will be same?
Rupanjana 2-Nov-11 6:52am    
Just now i tried the code in my web page.it shows a compilation error that is:The name 'bytes' does not exist in the current context

What will be the solution?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900