Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: ASP.NET C#4.0
Dear,
 
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
 
pdfRenderer.Save(Server.MapPath("~/PDF/AdahiReport.pdf"));
 
Process.Start(Server.MapPath("~/PDF/AdahiReport.pdf"));
 

and the application is in the server path C:/report and the folder is c:/report/PDF
 
Kindly help me
 
regards
Posted 2-Oct-12 22:44pm
Rate this: bad
good
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\\))
{
Directory.Create((@"C:\\PDF\\));
}
then complete your code.
  Permalink  
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  
Rate this: bad
good
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");
 
Thanks
Rohit
  Permalink  
v2

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

  Print Answers RSS
0 OriginalGriff 310
1 Sergey Alexandrovich Kryukov 201
2 PhilLenoir 164
3 Magic Wonder 162
4 Richard MacCutchan 160
0 Sergey Alexandrovich Kryukov 6,140
1 OriginalGriff 5,195
2 CPallini 2,473
3 Richard MacCutchan 1,607
4 Abhinav S 1,505


Advertise | Privacy | Mobile
Web01 | 2.8.140814.1 | Last Updated 4 Oct 2012
Copyright © CodeProject, 1999-2014
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