• 0

[ASP.NET] Process.start Access Denied error


Question

Hi All,

Ok I have an asp.net site using vb.net which starts a new process to run the command prompt so I can execute several commands. This works on a localhost and on IIS on my own machine. However when I publish this and host it on another machine I recieve Access is denied when the process.start line executes. I assume this is a permission issue so I tried setting up a new user and specifying the login credentials for a user who definatley has permission to do this, however I get the same error. Is there something I need to configure in IIS to do this? I have enabled scripting.

My code is below:

Dim info = New Diagnostics.ProcessStartInfo()

' Set location of imagemagick resource we wish to use

info.FileName = "c:\windows\system32\cmd.exe"

info.UseShellExecute = False

info.CreateNoWindow = True

info.RedirectStandardInput = True

info.RedirectStandardOutput = True

Dim proc As Diagnostics.Process = New System.Diagnostics.Process

proc.StartInfo = info

proc.Start() !! This is where I get the error

Dim sr As StreamReader = proc.StandardOutput

' Create command to execute

Dim CMDLine As String = "rest of command I build up"

Using sw As StreamWriter = proc.StandardInput

If sw.BaseStream.CanWrite Then

sw.WriteLine("""C:\Program Files\ImageMagick-6.5.6-Q16\convert.exe"" " & CMDLine)

sw.Flush()

End If

End Using

So Im basically start a new process opening up cmd and using it to run a utility of imagemagick, I use a streamwriter to write to the command prompt. As I say this code works but not when I publish it but I cant see what I need to do to allow the IIS user to start the process. ANy help would be great.

1 answer to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.