onse.End(); } } //所有子目录
第 3 个文件 ShowFile.aspx,这个页面中布局一个 HtmlTable,用来显示相应的文件信息.下面是在它 的 HTML 代码,读者可以通过它看到 Table 的结构,非常简单.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ShowFile.aspx.cs" Inherits="ShowFile" %> <%@Import Namespace= "System.IO" %> <
HTML XMLNS="W3.ORG xhtml? 1999>
<% string file2Show = Request.QueryString.Get("file"); FileInfo thisOne = new FileInfo(file2Show); %>
xml:namespace prefix = table style="width />
name | <%= thisOne.Name%> | create date | |
path | <%= thisOne.FullName%> | size | <%=thisOne.Length.ToString()%> |
directory | <%= thisOne.DirectoryName%> | last access | <%= thisOne.LastAccessTime.ToString()%> |
last modified | <%= thisOne.LastWriteTime.ToString()%> | |
|
<% StreamReader reader = thisOne.OpenText(); char[] buffer = new char[1000]; int nRead = reader.ReadBlock(buffer,0,255); Response.Write("
"); Response.Write(new string(buffer,0,nRead)); Response.Write("
"); %>
例程完全代码版
(3)——随意创建图形信息 (3)—— ASP.NET 例程完全代码版(3)——随意创建图形信息
2006-04-03 11:26:00
随意创建图形信息 功能: 可以选择输出图象的文本; 可以选择文本的颜色; 可以选择背景的颜色; 可以选择字体; 可以选择字号; 用途:比如显示自己的一个计数器,或者验证码等等. 第一个 aspx——Start.aspx:这是一个简单的用来设定图象属性的页面,如文本,颜色,大小等等,放置 了 3 个 HtmlTextBox,后来发现在 codebehind 中不能识别控件名称,呵呵,失误,只好加了 runat="Server";然后是两个服务器端的 DropDownList,来设置字体颜色和背景色. <%@ Page Language="C#" %>