2013-01-08 83 views
1

限制對特定用戶的文件夾訪問。使用vb.net。在一個變量傳遞用戶名和密碼。但在這行我得到錯誤,如在above.the變量mailid提到和pwd包含類似XX一定的價值和YY從字符串到類型long的轉換在vb.net中無效錯誤

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) 

回答

0

試着改變你的線以下........

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

基本上,我可以理解它是把你的字符串聲明作爲一個SUM,並試圖將DIVIDE mailid BY pwd所以因此它認爲它的字符串,並試圖將其轉換爲數字。

相關問題