I have created a PDF file and saving to the folder inside the application path. Locally working fine, but when i moved the file to the server it wont save to the folder.
Below is the code I used to save and open it
and the application is in the server path C:/report and the folder is c:/report/PDF
Kindly help me
Use the Physical Path directly, No need for using Server.MapPath("~/PDF/AdahiReport.pdf").
like this (@"C:\\PDF\\AdahiReport.pdf").
and check if the file directory is exists or not, if not exists, create one.
then complete your code.
You are using asp.net. If you use the Process.Start functionality all you will do is launch the server's default PDF reader ON THE SERVER. This will do nothing on the client side. Either you have mistakenly tagged your question with ASP.NET, or you have made a very basic error in understanding what happens on the server and what will be sent to the client.
Please verify that the application pool identity has permission to write on the folder the application is deployed i.e. C:/report. If not grant write permission and it should work fine. One more thing if you want to open the pdf file from server on client machinie, then Process.Start(Server.MapPath("~/PDF/AdahiReport.pdf")); code will not work, you need to write response.redirect ("~/PDF/AdahiReport.pdf");
Edited 3-Oct-12 5:17am
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)