If chkdirectory.Checked = True Then
Dim i As Integer = 0
Dim c As Integer = 0
Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
Dim d As DriveInfo
Dim path As String = ""
For Each d In allDrives
If d.IsReady = True And d.DriveType = DriveType.Fixed Then
path = d.Name
c = c + 1
If txtadvsearch.Text <> "" Then
Dim di As DirectoryInfo = New DirectoryInfo(path)
Dim count As Integer
If di.Exists Then
count = count + 1
If count = 1 Then
Response.Write("<table style=width: 428px border=0 color=black>")
' Response.Write("<tr><td class=OptionName>")
' Response.Write(di.FullName)
' Response.Write("</td></tr>")
End If
Dim dir As DirectoryInfo
Dim tdir As String = "*" + txtadvsearch.Text + "*"
For Each dir In di.GetDirectories(tdir, SearchOption.AllDirectories)
Response.Write("<tr><td class=OptionName>")
Response.Write(dir.FullName)
Response.Write("</td></tr>")
'If dir.Attributes And FileAttributes.System Then
' MsgBox(dir.Name & " is a system file")
'End If
Next
If count <> 0 Then
Response.Write("</table")
End If
Else
Response.Write("<table style=width: 428px border=0 color=black><tr><td class=OptionName>Directory " & path & " doesnt exist</td></tr></table>")
End If ' di endif
Else
MsgBox("Enter Directory name")
End If 'txtadvsearch null endif
End If 'For drives end if
Next
End If 'end of chkdir
End Sub
Above is my code for searching in all logical drives for all the foldernames named "New" eg.The initial error was SysteVolumeInformation.When i granted access to my user account and uncheked read only it worked fine.After running thru vs.net 2005 it works fine.Later i removed the
vb code and made it as inline code as in inside the html i wrote the asp.net code and run it locally(
http://localhost/FileAccess/GWFile.aspx) without a web.config in the folder.Now i am getting an error for all the readonly files.eg.C:\windows\temp is denied first.when i uncheked it the next error pops up for the next read only file.How to avoid this error if im runnining it without using visual studio.