Click here to Skip to main content
15,907,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello Friends,

i am right now in big trouble. i have web application for order management. when i click on Shipped button my order shipped and create one PDF file and store in one folder and directly open for print this PDF. this are working fine in localhost. when i publish this in IIS 5.1 my pdf not working. it create in folder but not open directly.

here is code for that :-

C#
System.Diagnostics.Process.Start("C:/Inetpub/wwwroot/test/FedExShipPDF/793947412770.pdf");
Posted
Updated 30-Oct-12 2:40am
v2

Yatin, Its very natural and basic.
If your execute Process.Start on server it will start your PDF on your server not on your client.
Please go to your server open task manager , in processes tab check how many adobe arcobat reader process is running.

Assumption : acrobat reader is installed on your server
 
Share this answer
 
Comments
Yatin chauhan 30-Oct-12 8:56am    
sir i know that .. in task manager acrobate32.exe start. but PDF not open. in the same way when run this code in local machine then its work fine and direct open the PDF... where i am wrong??
[no name] 30-Oct-12 9:19am    
Most of the time on servers when you run process.start it runs as non desktop interactive. You need to try this one. (i have posted it as another solution)
C#
public void OpenWithStartInfo()
      {
          ProcessStartInfo startInfo = new ProcessStartInfo("acrobate32.exe");
          startInfo.WindowStyle = ProcessWindowStyle.Maximized;                  Process.Start(startInfo);

          startInfo.Arguments = "YourPDFPath";
          Process.Start(startInfo);

      }
 
Share this answer
 
v2
Comments
Yatin chauhan 30-Oct-12 9:38am    
i have write this code and its give the error so me add this line
startInfo.UseShellExecute = false;


now my pdf open in local but still it give error like
"The specified executable is not a valid Win32 application."
[no name] 30-Oct-12 9:41am    
pls share your new code...
Yatin chauhan 30-Oct-12 9:42am    
System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(pdfPath);
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
System.Diagnostics.Process.Start(startInfo);
startInfo.UseShellExecute = false;
[no name] 30-Oct-12 9:46am    
TRy this ...

System.Diagnostics.ProcessStartInfo startInfo = new System.Diagnostics.ProcessStartInfo(acrobate32.exe);
startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Maximized;
startInfo.Arguments = pdfPath;

System.Diagnostics.Process.Start(startInfo);
startInfo.UseShellExecute = false;
Yatin chauhan 30-Oct-12 9:52am    
it give error like :-

The Process object must have the UseShellExecute property set to false in order to use environment variables.

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