Jump to content

Featured Replies

Posted

I am working on a web interface to let users manage their own quotas. Everyting seems to work ok, except for user impersonations. Ather executables, like notepad, run just fine with my code, which is the C# version of *Runas...". But for dirquota I always get "The requested operation requires elevation".

 

Here is my code...

 

String DirQuota = ConfigurationManager.AppSettings["DirQuotaPath"]

String sArgument1 = " template list /remote:\"" + _servername + "\""

System.Security.SecureString password = new System.Security.SecureString()

foreach (char c in sPassword)

{

password.AppendChar©

}

ProcessStartInfo startInfo = new ProcessStartInfo(DirQuota, sArgument1)

if (this.chkRunAsLocal.Checked == false)

{

startInfo.Domain = "xxx"

startInfo.UserName = sUserName

startInfo.Password = password

}

startInfo.WindowStyle = ProcessWindowStyle.Minimized

startInfo.CreateNoWindow = true

startInfo.RedirectStandardError = true

startInfo.RedirectStandardOutput = true

startInfo.UseShellExecute = false

Process proc = new Process()

proc.StartInfo = startInfo

proc.Start()

any ideas?

thanks

--tolga

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...