run .exe from web service - looking for ideas

R

ryan.mclean

Hello everyone, I am trying to accomplish something, and the way I had
intended is not working out, so I am looking for ideas.

Here is what I am trying to accomplish. I must preface this by saying
that I am new to iis and iis security.

I have a .exe that must stay on the server. I would like people to be
able to run this .exe with specified parameters/switches without
interacting directly with the server.

I had thought to use a web service to accomplish this, but I am running
into permission problems. Here is my web service; if it helps to
explain (I have tried both versions):

<WebMethod(MessageName:="Unsigned")> _
Public Overloads Function Encrypt(ByVal a_strEncryptKey As String,
_
ByVal a_strDestPath As String, _
ByVal a_strFilePath As String) As String

Dim strReturn As String

Dim objProcess As Process
Dim objProcessInfo As ProcessStartInfo

Try

objProcess = New Process()
objProcessInfo = New ProcessStartInfo("pgp", "-ea """ +
a_strFilePath + """ """ + a_strEncryptKey + """ -z secretkey")
objProcess.StartInfo = objProcessInfo
objProcess.EnableRaisingEvents = True
objProcess.Start()
objProcess.WaitForExit()

Catch ex As Exception
strReturn = ex.ToString
End Try

Return strReturn

End Function


AND

<WebMethod(MessageName:="Unsigned")> _
Public Overloads Function Encrypt(ByVal a_strEncryptKey As String,
_
ByVal a_strDestPath As String, _
ByVal a_strFilePath As String) As String

Dim strReturn As String

Dim objProcess As Process
Dim objProcessInfo As ProcessStartInfo

Try

objProcess = New Process()
objProcessInfo = New ProcessStartInfo("cmd.exe")
objProcessInfo.RedirectStandardInput = True
objProcessInfo.RedirectStandardOutput = True
objProcessInfo.UseShellExecute = False

objProcess = Process.Start(objProcessInfo)

objProcess.StandardInput.WriteLine("pgp -ea """ +
a_strFilePath + """ """ + a_strEncryptKey + """ -z secretkey")
objProcess.StandardInput.WriteLine("exit")
strReturn = objProcess.StandardOutput.ReadToEnd
Catch ex As Exception
strReturn = ex.ToString
End Try

Return strReturn

End Function

It works if I try these in a windows application, that's why I
believe the problem to be permissions related. I have tried mucking
with the security on the pgp.exe file, the .net framework configuration
thingy, and I'm sure other permissions settings. Not really knowing
what I'm doing makes it a frustrating 'shotgun approach' (hoping
something will work).

So now, I am looking for any suggestions on how to make the web service
work or a better way to accomplish this. I hope this makes sense; my
head is a little sore from banging it against the keyboard :)

Thank you for any help.

Have a great night!
Ryan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top