限制特定用户对文件夹的访问。使用 vb.net.In 变量传递 username 和 pwd 。但在那一行我得到了上面提到的错误。变量mailid和pwd包含一些像xx和yy这样的值
code
----
Dim FolderPath As String = "D:\ABC\2011\TAccount\HA\" 'Specify the folder here
Dim UserAccount As String = mailid \ pwd
Dim FolderInfo As IO.DirectoryInfo = New IO.DirectoryInfo(FolderPath)
Dim FolderAcl As New DirectorySecurity
FolderAcl.AddAccessRule(New FileSystemAccessRule(UserAccount, FileSystemRights.FullControl, InheritanceFlags.ContainerInherit Or InheritanceFlags.ObjectInherit, PropagationFlags.None, AccessControlType.Deny))
FolderInfo.SetAccessControl(FolderAcl)