1

限制特定用户对文件夹的访问。使用 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)
4

1 回答 1

0

尝试将您的线路更改为以下......

Dim UserAccount As String = mailid & "\" &  pwd

基本上,我可以理解它正在将您的字符串声明作为 SUM 并尝试将 mailid BY pwd 划分,因此它认为它是一个字符串并试图将其转换为一个数字。

于 2013-01-10T00:48:45.737 回答