Click here to Skip to main content
15,890,185 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I've tried as below and is working fine in local machine. But when i host the application then it's not working..

..thanks

What I have tried:

C#
private void ReadPdfFile(string FilePath)
   {
       WebClient client = new WebClient();
       Byte[] buffer = client.DownloadData(FilePath);
       Process.Start(FilePath);
   }

ReadPdfFile(DirPath + @"\" + PDFFileName.Trim()); /*Method Call*/
Posted
Updated 12-Aug-16 3:32am
v5

1 solution

Your code is running on the server so the pdf is opening on the server, but no-one is there to see it and more than likely your threads are hanging or are throwing errors. It appeared to work when developing locally because the client and server were the same machine.

To show a PDF on the client you just return it as a PDF file. Google "asp.net download PDF to client" and you'll find sample code.
 
Share this answer
 
Comments
ridoy 13-Aug-16 6:21am    
a 5.

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