Jump to content
Forum²

Recommended Posts

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...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...