位置:海鸟网 > IT > ASP.NET >

开心就贴(二)

<%@ Page Language="C#" Debug="true" %>

<%@ Import Namespace="System.IO" %>
<s cript language="C#" runat="server">
    protected void Page_Load(Object Src, EventArgs E){         
    string str;
   
    StringTable st = new StringTable();
StreamReader din = new StreamReader("c:\test.txt",Encoding.Default);
/*构建StreamReader时,可以附带第二个函数,即其编码,默认情况下会用UTF-8打开。另外,兄弟,不要脱了裤子放屁浪费一个手续,StreamReader本身就可以
打开文件的(It's only a joke)*/
while ((str=din.ReadLine()) != null) {
st.Add(str);
}
foreach (string ss in st)
{
Response.Write (ss);
}
       }
</s cript>