Search code examples
asp.netserverwscript.shell

Which user runs cmd on server where aspx file is located


We use an aspx webpage that has two variables in the link. Example:

aspxpage.aspx?argument1=arg1&argument2=arg2

the aspx calls a .cmd and passes the two arguments to it. The code is:

dim wshell
dim arg1
dim arg2
dim runcmd

arg1 = Request.Querystring("arg1")
arg2 = Request.Querystring("arg2")

wshell = CreateObject("WScript.Shell") 
runcmd = """path\to\run.cmd """ + arg1 & " " & arg2 & ""
wshell.run (runcmd, 1, true )
wshell = nothing

I am wondering how to check which user calls the .cmd on the server where this is all running. Need to know this to check whether that user has the approriate rights run the cmd and all functions called by the cmd.


Solution

  • Based on comment, I did some Googling. Found out that the defaultAppPool user needed folder permissions to write in the folder. After granting the rights to the user, the application is working again.

    https://learn.microsoft.com/en-us/iis/manage/configuring-security/application-pool-identities