Click here to Skip to main content
15,920,896 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionRe: .net framework 2.0.50727 Pin
Sonia Gupta11-May-07 22:03
Sonia Gupta11-May-07 22:03 
AnswerRe: .net framework 2.0.50727 Pin
P P Vilsad11-May-07 22:26
P P Vilsad11-May-07 22:26 
QuestionRe: .net framework 2.0.50727 Pin
Sonia Gupta11-May-07 23:16
Sonia Gupta11-May-07 23:16 
AnswerRe: .net framework 2.0.50727 Pin
P P Vilsad12-May-07 19:45
P P Vilsad12-May-07 19:45 
Questionsetup exploration [modified] Pin
Sonia Gupta11-May-07 18:26
Sonia Gupta11-May-07 18:26 
QuestionProblem in OleDbDataAdapter.Update [modified] Pin
azusakt11-May-07 17:02
azusakt11-May-07 17:02 
QuestionHow to hide frame when clicking on white area of listview where there is no data? Pin
method00711-May-07 9:56
method00711-May-07 9:56 
Questionmultiple file search Pin
jds120711-May-07 7:05
jds120711-May-07 7:05 
AnswerRe: multiple file search Pin
P P Vilsad11-May-07 9:03
P P Vilsad11-May-07 9:03 
GeneralRe: multiple file search Pin
jds120711-May-07 9:07
jds120711-May-07 9:07 
AnswerRe: multiple file search Pin
P P Vilsad11-May-07 9:30
P P Vilsad11-May-07 9:30 
GeneralRe: multiple file search Pin
jds120711-May-07 9:54
jds120711-May-07 9:54 
GeneralRe: multiple file search Pin
P P Vilsad11-May-07 10:11
P P Vilsad11-May-07 10:11 
GeneralRe: multiple file search Pin
jds120711-May-07 10:26
jds120711-May-07 10:26 
GeneralRe: multiple file search Pin
P P Vilsad11-May-07 10:35
P P Vilsad11-May-07 10:35 
QuestionVB GIS Project Pin
Zigoxo11-May-07 5:43
Zigoxo11-May-07 5:43 
AnswerRe: VB GIS Project Pin
Colin Angus Mackay11-May-07 5:53
Colin Angus Mackay11-May-07 5:53 
Questionregarding datagrid problem in vb.net? Pin
sathyan_829411-May-07 5:18
sathyan_829411-May-07 5:18 
AnswerRe: regarding datagrid problem in vb.net? Pin
Kevin Nicol11-May-07 7:35
Kevin Nicol11-May-07 7:35 
QuestionSetting Permissions for new folders .NET 2.0 Pin
aro198111-May-07 4:35
aro198111-May-07 4:35 
Setting permissions for new folders .NET 2.0 8mins ago

Hello,
I have seen the vb.net sample code on msdn for setting permissions for new folders (below), but still have some questions about it. I am writing a program that creates new folders, and sets permissions for the new folders. An Access database contains the permissions for each group. I have found very little information and examples for this subject. If anyone is familiar with security and the .NET 2.0 framework, I would greatly appreciate the help. Thank you for reading this message!

Imports System
Imports System.IO
Imports System.Security.AccessControl



Module DirectoryExample

Sub Main()
Try
Dim DirectoryName As String = "TestDirectory"

Console.WriteLine("Adding access control entry for " + DirectoryName)

' Add the access control entry to the directory.
AddDirectorySecurity(DirectoryName, "MYDOMAIN\MyAccount", FileSystemRights.ReadData, AccessControlType.Allow)

Console.WriteLine("Removing access control entry from " + DirectoryName)

' Remove the access control entry from the directory.
RemoveDirectorySecurity(DirectoryName, "MYDOMAIN\MyAccount", FileSystemRights.ReadData, AccessControlType.Allow)

Console.WriteLine("Done.")
Catch e As Exception
Console.WriteLine(e)
End Try

Console.ReadLine()

End Sub


' Adds an ACL entry on the specified directory for the specified account.
Sub AddDirectorySecurity(ByVal FileName As String, ByVal Account As String, ByVal Rights As FileSystemRights, ByVal ControlType As AccessControlType)
' Create a new DirectoryInfoobject.
Dim dInfo As New DirectoryInfo(FileName)

' Get a DirectorySecurity object that represents the
' current security settings.
Dim dSecurity As DirectorySecurity = dInfo.GetAccessControl()

' Add the FileSystemAccessRule to the security settings.
dSecurity.AddAccessRule(New FileSystemAccessRule(Account, Rights, ControlType))

' Set the new access settings.
dInfo.SetAccessControl(dSecurity)

End Sub


' Removes an ACL entry on the specified directory for the specified account.
Sub RemoveDirectorySecurity(ByVal FileName As String, ByVal Account As String, ByVal Rights As FileSystemRights, ByVal ControlType As AccessControlType)
' Create a new DirectoryInfo object.
Dim dInfo As New DirectoryInfo(FileName)

' Get a DirectorySecurity object that represents the
' current security settings.
Dim dSecurity As DirectorySecurity = dInfo.GetAccessControl()

' Add the FileSystemAccessRule to the security settings.
dSecurity.RemoveAccessRule(New FileSystemAccessRule(Account, Rights, ControlType))

' Set the new access settings.
dInfo.SetAccessControl(dSecurity)

End Sub
End Module



AR






AR
QuestionSAP.net Connector Pin
sunder vel11-May-07 3:38
sunder vel11-May-07 3:38 
AnswerRe: SAP.net Connector Pin
Dave Kreskowiak11-May-07 3:58
mveDave Kreskowiak11-May-07 3:58 
Questioncode for forex exchange using vb.net 2003 Pin
Stormint11-May-07 3:19
Stormint11-May-07 3:19 
AnswerRe: code for forex exchange using vb.net 2003 Pin
Dave Kreskowiak11-May-07 3:57
mveDave Kreskowiak11-May-07 3:57 
AnswerRe: Data Reports Pin
Dave Kreskowiak11-May-07 3:55
mveDave Kreskowiak11-May-07 3:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.