Thanks a ton! Pranav
Pranav Soral
Posts
-
How to access Local Security Policy using c# -
How to set permission(Full control) to the folder..This namespace is specific to .Net 2.0 I will try to write code which works for 1.1. Thanks, Pranav
-
How to set permission(Full control) to the folder..Try the following. //Add these namespaces to your page. using System.IO; using System.Security.AccessControl; using System.Security.Principal; //Put this code in either Page_Load or any other function string DirectoryName = @"C:\Test"; //Make sure the directory exists. string Account = @"Domain\username"; //Replace it with your Domain Name and User Name. DirectoryInfo dInfo = new DirectoryInfo(DirectoryName); DirectorySecurity dSecurity = dInfo.GetAccessControl(); dSecurity.AddAccessRule(new FileSystemAccessRule(Account, FileSystemRights.FullControl, AccessControlType.Allow)); dInfo.SetAccessControl(dSecurity); Hope it helps! Pranav
-
How to access Local Security Policy using c#I want to access Local Security Policy (User Rights assignment) using C#. Is it possible? My requirement is to add/remove users from certain policies programatically. Thanks, Pranav
-
How to access Local Security Policy using c#I want to access/modify Local Security Policy (User Rights Assignment) using C#. Is it possible? My requirement is to add/remove a user from a certain policy. Thanks in advance, Pranav