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

i have one problem for open an PDF file after create.

i am create an pdf file and store in folder and after direct open that but it give error like

The Specified Executable is not a valid win32 application

here is code :
C#
private static void DisplayLabel(string labelFileName)
    {
        System.Diagnostics.Process myProcess = new System.Diagnostics.Process();
        System.Diagnostics.ProcessStartInfo myinfo = new System.Diagnostics.ProcessStartInfo(labelFileName);
        myinfo.UseShellExecute = false;
        myinfo.RedirectStandardOutput = true;
        myProcess.StartInfo = myinfo;
        myProcess.Start();

        myProcess.StandardOutput.ReadToEnd();
        myProcess.WaitForExit();
    }



[edit]Code block added - OriginalGriff[/edit]
Posted
Updated 24-Oct-12 22:28pm
v2

1 solution

If this is really ASP.NET, then that isn't going to work, except in development anyway.
C# code runs in the codebehind - i.e. on the SERVER. So any process that is run will execute on the Server, not the Client and thus be invisible to the user (as well as annoying the heck out of your web server administrator)
It may appear to work in development, when the same computer is the client and the server, but will fail when you go to production.

If this isn't web based, then you need to check the file name and make sure it includes the extension, and that a PDF file reader are registered.
 
Share this answer
 
Comments
Yatin chauhan 25-Oct-12 4:55am    
This is in C# code. i have using FedEx web service for create an shipment PDF file .its work nice and store my folder but when i open after created its not opened. its give error like that
OriginalGriff 25-Oct-12 5:01am    
Put a breakpoint on the line
System.Diagnostics.ProcessStartInfo myinfo = new System.Diagnostics.ProcessStartInfo(labelFileName);
and see exactly what is in labelFileName - then let me know what it is.
Yatin chauhan 25-Oct-12 7:23am    
i have already debug and in my labelfilename display a full path of my pdf file location like

D:\CourierRate\FedExShipPDF\789456134.pdf

now the file store there but when i open its not do that...!!

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