Wrox Programmer Forums
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 19th, 2007, 06:59 AM
Authorized User
Join Date: Jan 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default directoryinfo in asp.net

 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>")

                                'If dir.Attributes And FileAttributes.System Then
                                ' MsgBox(dir.Name & " is a system file")
                                'End If

                            If count <> 0 Then
                            End If

                            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

                        MsgBox("Enter Directory name")

                    End If 'txtadvsearch null endif
                End If 'For drives end if
        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.

Similar Threads
Thread Thread Starter Forum Replies Last Post
ASP.NET 3.5 answers in Professional ASP.NET 3.5 jminatel ASP.NET 3.5 Professionals 1 August 22nd, 2011 07:34 AM
Turning a regular ASP.NET App into an AJAX ASP.Net donrafeal7 Ajax 2 August 31st, 2007 12:33 AM
DirectoryInfo or................. mike_remember ASP.NET 1.0 and 1.1 Professional 2 December 28th, 2005 04:42 AM
DirectoryInfo.GetFiles(pattern): search pattern fo arif_1947 VS.NET 2002/2003 1 October 19th, 2004 11:59 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.