Click here to Skip to main content
12,954,276 members (74,224 online)
Rate this:
Please Sign up or sign in to vote.
See more:

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

Posted 2-Oct-12 22:44pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

You are using 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.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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.

if(!File.Exists (@"C:\\PDF\\))
then complete your code.
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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");


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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 6,524
CHill60 3,490
Maciej Los 3,123
ppolymorphe 2,030
Jochen Arndt 1,975

Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 4 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100