Reputation: 1515
I have an ASP.Net application deployed on the server. I want to know whether it will be able to access my local system exe files on button click.
I read a lot of articles regarding this on the Internet. Some are saying it is not possible for the ASP.Net application to access local programs. While some were suggesting that it depends on Permissions, identities and other things .
I tried a similar thing on my local machine but even after giving access permission to Local System, Network Service for the file and even changing the Application Pool identity to local system, i was not able to accomplish the same...
So i just want to confirm whether this thing is possible or not...
Here is the code i am trying to execute
Dim pstartinfo As New ProcessStartInfo()
Dim p As New Process()
pstartinfo.WorkingDirectory = "D:\VS2010Projects\SignatureCaptureWindows\bin\Debug"
pstartinfo.FileName = "SignatureCaptureWindows.exe"
pstartinfo.CreateNoWindow = False
p = Process.Start(pstartinfo)
p.WaitForExit()
If (Not p.ExitCode.Equals(0)) Then
Response.Write("Image Successfully saved in Database with ID = " + p.ExitCode.ToString())
DisplaySavedImage(p.ExitCode)
Else
End If
On running on locahost, it works fine.. When i deploy it on my Local IIS, it doesn't open the exe
Upvotes: 1
Views: 4423
Reputation: 499012
It is possible and requires that the application pool user has permissions to the location of the executable and permissions to execute it.
You can use the Process
class to execute pretty much anything (even with different user credentials if needed).
Don't forget that trying to run an application with a UI will not generally work well, as the application pool does not run in an interactive environment (so, it can't open windows and click buttons).
You should limit yourself to executables that are not interactive, as the web server will not be able to interact with windows and such.
In your specific scenario, where you need the user to enter their signature and it gets saved - you need them to upload the signature (I am assuming an image file exists already), or create such an image on the client side (say with canvas
and JavaScript). You could then upload the image and save it.
Upvotes: 1