Is it possible to run method of class as administrator from process started without administrator privilegies?
For example, I have a method:
void BeginTransfer(string from)
{
//...
}
I need to ask user for administrator privilegies for run this method. Something like total commander ask before copy files to system disk or program files folder.
I trying to use PrincipalPermission
attribute but it not works for me:
[PrincipalPermission(SecurityAction.Demand, Role = @"BUILTIN\Administrators")]
it throws an exception: Failure to request permissions for the account holder
(translated from russian)
So what I doing wrong?