showfile.aspx
来自「《精通ASP.NET网络编程》附带实例」· ASPX 代码 · 共 40 行
ASPX
40 行
<% @Page Language="C#" %>
<% @Import Namespace="System.IO" %>
<html>
<head><title>File Info</title></head>
<body>
<%
string strFile2Show = Request.QueryString.Get("file");
FileInfo thisOne = new FileInfo(strFile2Show);
%>
<table>
<tr><td>Name:</td><td><%=thisOne.Name%></td></tr>
<tr><td>Path:</td><td><%=thisOne.FullName%></td></tr>
<tr><td>Directory:</td><td><%=thisOne.DirectoryName%></td></tr>
<tr>
<td>Date created:</td>
<td><%=thisOne.CreationTime.ToString()%></td>
</tr>
<tr>
<td>Size:</td>
<td><%=thisOne.Length.ToString()%> Bytes</td>
</tr>
<tr>
<td>Last access:</td>
<td><%=thisOne.LastAccessTime.ToString()%></td>
</tr>
<tr>
<td>Last modified:</td>
<td><%=thisOne.LastWriteTime.ToString()%></td>
</tr>
</table>
<%
StreamReader theReader = thisOne.OpenText();
char[] theBuffer = new char[255];
int nRead = theReader.ReadBlock(theBuffer, 0, 255);
Response.Write("<pre>");
Response.Write(Server.HtmlEncode(new String(theBuffer,0,nRead)));
Response.Write("</pre>");
%>
</body>
</html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?