Setting User Permissions?
-
I can connect to a remote registry using microsoft.win32 package.. but it only works if i have authentication.. and the only way i know how to get it is try to access the computer over the network and fill in the details:P how do i gain permission using c# code? :)
-
I can connect to a remote registry using microsoft.win32 package.. but it only works if i have authentication.. and the only way i know how to get it is try to access the computer over the network and fill in the details:P how do i gain permission using c# code? :)
By default, the CurrentPrincipal on the thread is GenericPrincipal. If you set the CurrentPrincipal to WindowsPrincipal it should be the same as doing a RunAs. You can access the property off of the current thread (System.Threading.Thread.CurrentPrincipal). You can also set this at the AppDomain level, but you can only do this once during the entire life of the application domain. By doing it at the domain level, you inherit the WindowsPrincipal througout all threads within that application domain.
-
By default, the CurrentPrincipal on the thread is GenericPrincipal. If you set the CurrentPrincipal to WindowsPrincipal it should be the same as doing a RunAs. You can access the property off of the current thread (System.Threading.Thread.CurrentPrincipal). You can also set this at the AppDomain level, but you can only do this once during the entire life of the application domain. By doing it at the domain level, you inherit the WindowsPrincipal througout all threads within that application domain.
ok im not too familiar with CurrentPrincipal.. so could i plz have a code example to show me how to pass credentials to a remote computer to access their registry :) thanks
-
ok im not too familiar with CurrentPrincipal.. so could i plz have a code example to show me how to pass credentials to a remote computer to access their registry :) thanks
Getting credentials to see if a user is in a particular role is easy. Passing credentials from one system to another to access registry information is not. If it was easy, we'd have one more security patch to be applied to Windows because it would be such an easy hack. If there were a real business justification for doing something like this, then about the only way I could think of was to have the user install an agent and access the agent via remoting. This signature left intentionally blank