⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 default.aspx

📁 This is a book about vb.you could learn this from this book
💻 ASPX
字号:
<%@ Import Namespace="System.IO" %>
<script runat="server">
	Sub Page_Load( sender as object, e as EventArgs)
		if not Request("dir") is nothing  then
			DirName.Value = Request("dir")
		end if
	End Sub
</script>

<h3>ASP.NET Directory Browser</h3>

<form runat="server">
	Directory Name: <input type="text" id="DirName" size="60" 
				value="c:\program files\internet explorer" runat="server" >
	<input type="submit" value="List">
</form>

<%
	dim dir as DirectoryInfo
	dim anchor as string

	' Get the information about the selected directory
	
	dir = new DirectoryInfo( DirName.Value )

	Response.Write("<h3>Sub Directories in " & DirName.Value & "</h3>")

	Response.Write("<table>")
	Response.Write("<tr bgcolor=cornflowerblue>")
 	Response.Write("<td>")
	Response.Write( "Name" )
 	Response.Write("<td>")
	Response.Write( "Last Modified" )
	Response.Write("</tr>")

	dim SubDir as DirectoryInfo

	for each SubDir in dir.GetDirectories() 
		anchor = "<a href='" & "default.aspx?dir=" & SubDir.FullName & "'>" + SubDir.Name & "</a>"
		Response.Write("<tr>")
 		Response.Write("<td>" & anchor & "</td>" )
 		Response.Write("<td>" & SubDir.LastWriteTime & "</td>" )
		Response.Write("</tr>")
	next

	Response.Write("</table>")

	if ( not dir.Parent is nothing ) then
		anchor = "<a href='" & "default.aspx?dir=" & dir.Parent.FullName & "'>" & dir.Parent.FullName & "</a>"
		Response.Write("<p>Parent directory is " & anchor )
	end if
	
	Response.Write("<h3>Files in " & DirName.Value & "</h3>")

	Response.Write("<table>")
	Response.Write("<tr bgcolor=cornflowerblue>")
 	Response.Write("<td>Filename</td>" )
 	Response.Write("<td>Last Modified</td>" )
 	Response.Write("<td>Size</td>" )
	Response.Write("</tr>")
	
	dim f as FileInfo

	for each f in dir.GetFiles()
		Response.Write("<tr>")
 		Response.Write("<td>" & f.Name )
		
		if ( (f.Attributes and FileAttributes.ReadOnly) <> 0 ) then
			Response.Write(" (read only)")
		end if

		if ( (f.Attributes and FileAttributes.Hidden) <> 0 ) then
			Response.Write(" (hidden)")
		end if

		if ( (f.Attributes and FileAttributes.System) <> 0 ) then
			Response.Write(" (system)")
		end if

		if ( (f.Attributes and FileAttributes.Archive) <> 0 ) then
			Response.Write(" (archive)")
		end if

		' Alternative way to write out attributes (rather than check for each one)
		'Response.Write( f.Attributes.ToString() )

 		Response.Write("<td>" & f.LastWriteTime & "</td>")
 		Response.Write("<td>" & f.Length.ToString() & "</td>" )
	
		Response.Write("</tr>")
	next

	Response.Write("</table>")
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -