using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

using System.IO;
public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        if (TextBox1.Text != "" && TextBox2.Text != "")
        {
            string path = Server.MapPath("Files") + "\\" + TextBox1.Text;
            FileInfo fi = new FileInfo(path);
            if (!fi.Exists)
            {
                StreamWriter myw = fi.CreateText();
                myw.WriteLine(TextBox2.Text);
                myw.Flush();
                myw.Close();
            }
            Response.Write("<script>alert('创建文件成功并写入内容!')</script>");
        }
        else
        {
            Response.Write("<script>alert('请输入文件名和文件类型!')</script>");
        }
    }
}
