日期:2014-05-19  浏览次数:20456 次

关于写入文件问题
我有2个textbox,1个用来显示文件的内容,另一个用于修改,程序如下


<%@   Page   Language= "C# "   AutoEventWireup= "true "   CodeFile= "HtmlTo.aspx.cs "   Inherits= "HtmlTo "   validateRequest= "false "     %>

<!DOCTYPE   html   PUBLIC   "-//W3C//DTD   XHTML   1.0   Transitional//EN "   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">

<html   xmlns= "http://www.w3.org/1999/xhtml "   >
<head   runat= "server ">
        <title> 无标题页 </title>
</head>
<body>
        <form   id= "form1 "   runat= "server ">
        <div>
                <asp:DropDownList   ID= "DropDownList1 "   runat= "server "   AutoPostBack= "True ">
                        <asp:ListItem   Value= "1.html "> 计算机科学与技术 </asp:ListItem>
                        <asp:ListItem   Value= "2.html "> 生物工程 </asp:ListItem>
                        <asp:ListItem   Value= "3.html "> 国际经济与贸易 </asp:ListItem>
                        <asp:ListItem   Value= "4.html "> 园林 </asp:ListItem>
                </asp:DropDownList> <br   />
                <br   />
                <asp:TextBox   ID= "TextBox1 "   runat= "server "   Height= "480px "   TextMode= "MultiLine "   Width= "386px "> </asp:TextBox> &nbsp; <br   />
                <asp:TextBox   ID= "TextBox2 "   runat= "server "> </asp:TextBox> <br   />
                <br   />
                <asp:Button   ID= "Button1 "   runat= "server "   Text= "确定 "   OnClick= "Button1_Click "   /> </div>
        </form>
</body>
</html>

---------------------

using   System;
using   System.Data;
using   System.Configuration;
using   System.Collections;
using   System.Web;
using   System.Web.Security;
using   System.Web.UI;
using   System.Web.UI.WebControls;
using   System.Web.UI.WebControls.WebParts;
using   System.Web.UI.HtmlControls;
using   System.IO;

public   partial   class   HtmlTo   :   System.Web.UI.Page
{
        protected   void   Page_Load(object   sender,   EventArgs   e)
        {
                string   filename;