in VB.Net

codice:
Sub Page_Load()
 Dim path As String = Request("path")
 If path Is Nothing Then
   path = "/"
 End If
 path = path.Replace("..", String.Empty).Replace("./", "/").Trim
 Dim dir As DirectoryInfo = New DirectoryInfo(Server.MapPath(path))
 For Each localDir As DirectoryInfo In dir.GetDirectories
   directories.Text += "[*]" + String.Format("{0}", localDir.Name, path)
 Next

 For Each localFile As FileInfo In dir.GetFiles
   files.Text += "[*]" + localFile.Name
 Next
End Sub
(convertito con C# to VB.Net di DeveloperFusion.com)