Create a Folder with Full permission and access Rights
-
Hi All, I am using vb.net 3.5 I am facing a problem when I am trying to attach a ".mdf" from my application's Data folder. its throws an error message "Access Denied",but when I am Change the permission manually the database attached successfuly. So, I am trying to Create Data folder's Perpisson and Rights Programiticaly, but it's not accessable. my code is : Try Dim DomainUser As String = Environment.UserDomainName & "\" & Environment.UserName Dim Dinfo As New DirectoryInfo(Folder) Dim Dsecurity As DirectorySecurity = Dinfo.GetAccessControl Dsecurity.AddAccessRule(New FileSystemAccessRule(DomainUser, FileSystemRights.FullControl, InheritanceFlags.ContainerInherit, PropagationFlags.None, AccessControlType.Allow)) Dsecurity.AddAccessRule(New FileSystemAccessRule(DomainUser, FileSystemRights.FullControl, InheritanceFlags.ObjectInherit, PropagationFlags.InheritOnly, AccessControlType.Allow)) Catch ex As Exception Debug.Print("GrantAllAccess EXCEPTION:") Debug.Print(ex.ToString) End Try ---------------------------------------------------------------------------------------------------- After doing This under Sequirity tab in "Allow " Columns all the Checkbox uncheck state, but into the advanced tab all the Checkbox Checked So, What I am doing to to check all the permission in "Security" Tab
Arindam Banerjee Sr. Software Developer Rance Computer Pvt Ltd. Kolkata (India)