Click here to Skip to main content
16,015,658 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a web application in C#. My Requirement : In button click event, i need to open an image from a local folder (
C:\temp\image35.jpg
) and edit and save it in a shared folder. During save in paint, i need to set the location by default.

I used the below code to open the image in paint. but, not able to set the location path during save.

Please help.

What I have tried:

System.Diagnostics.ProcessStartInfo procInfo = new System.Diagnostics.ProcessStartInfo(@"C:\temp\image35.jpg");
          procInfo.Verb = "edit";

          System.Diagnostics.Process.Start(procInfo);
Posted
Updated 20-Jul-17 0:22am

1 solution

Um.
That won't work. C# code runs on the Server, not the Client - and when you use Process.Start from C# code the process starts and runs on the Server, not on the Client, and has no access whatsoever to the Client file system.
It might appear to work on your development system because the Client and the Server are the same physical machine, but in production that is never the case and it fails.

Even if it did work - which it won't, you can't force an app to run on a client machine at all - you can't control where it is saved, for a huge number of reasons, one of which is: you have no idea what application will open to edit the file. On your computer it may be Paint. On mine it would be Corel Paintshop Pro X9. On my Android Tablet, I have no idea, and as for what the heck might happen on an Apple device of an internet connected fridge I don't want to speculate.

Find a better solution: you cannot do what you are trying.
 
Share this answer
 
Comments
Member 12498961 20-Jul-17 6:31am    
Is there any other way for my requirement?
OriginalGriff 20-Jul-17 6:43am    
You cannot run an application on the client, period. So no!
Member 12498961 20-Jul-17 7:36am    
Ok, Thank You...
OriginalGriff 20-Jul-17 7:41am    
You're welcome!

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