B
Brian Watkins
I am trying to loop through a directory and place all the folders and files
into an array. I want to store only the folders and files that the current
user has access to into the array. Below is some sample code of what I'm
doing:
Public Sub ProcessDirectory(byval strPath as string)
Dim strRootFolder As String = Server.MapPath(strPath)
Dim dir As New DirectoryInfo(strRootFolder)
Dim fsi As FileSystemInfo
For Each fsi In dir.GetFileSystemInfos()
Try
If TypeOf fsi Is FileInfo Then 'its a file
PutFileintoArray(fsi)
Else 'its a directory
Dim d As DirectoryInfo = CType( fsi, DirectoryInfo )
PutDirectoryintoArray(d.name)
ProcessDirectory(strpath & d.name & "/")
End If
Catch
End Try
Next fsi
End Sub
When the above code runs it stores all the folders and files nicely into the
array but it is not using the permissions of the client user. It only adds
the folders and files that everyone has access to. I need to run the above
code with the client users windows permissions.
In IIS Directory Security, the Anonymous access is unchecked and Integrated
Windows Authentication is checked.
In the Web.config authentication mode="Windows".
Does anyone know what I'm doing wrong here?
into an array. I want to store only the folders and files that the current
user has access to into the array. Below is some sample code of what I'm
doing:
Public Sub ProcessDirectory(byval strPath as string)
Dim strRootFolder As String = Server.MapPath(strPath)
Dim dir As New DirectoryInfo(strRootFolder)
Dim fsi As FileSystemInfo
For Each fsi In dir.GetFileSystemInfos()
Try
If TypeOf fsi Is FileInfo Then 'its a file
PutFileintoArray(fsi)
Else 'its a directory
Dim d As DirectoryInfo = CType( fsi, DirectoryInfo )
PutDirectoryintoArray(d.name)
ProcessDirectory(strpath & d.name & "/")
End If
Catch
End Try
Next fsi
End Sub
When the above code runs it stores all the folders and files nicely into the
array but it is not using the permissions of the client user. It only adds
the folders and files that everyone has access to. I need to run the above
code with the client users windows permissions.
In IIS Directory Security, the Anonymous access is unchecked and Integrated
Windows Authentication is checked.
In the Web.config authentication mode="Windows".
Does anyone know what I'm doing wrong here?