原文发布时间为:2008-08-06 —— 来源于本人的百度文章 [由搬家工具导入]

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;
using System.Text;

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

    }
    protected void Button1_Click(object sender, EventArgs e)
    {//create and write
        string info = TextBox1.Text;
        string name = TextBox3.Text;

        FileStream fs = new FileStream(Server.MapPath("~/txt/" + name + ".txt"), FileMode.Create, FileAccess.Write);
        StreamWriter sw = new StreamWriter(fs, Encoding.Default);
        sw.WriteLine(info);
        sw.Close();
        fs.Close();
        Response.Write("<script>alert('Create " + name + ".txt')</script>");

    }
    protected void Button2_Click(object sender, EventArgs e)
    {//read
        string name = TextBox4.Text;
        TextBox2.Text = File.ReadAllText(Server.MapPath("~/txt/" + name + ".txt"), Encoding.Default);
    }
}

最新文章

  1. UVA 1513 Movie collection (树状数组+反向存储)
  2. 一步一步安装UEFI分区方式的windows 10 企业版
  3. swift_简单值 | 元祖 | 流程控制 | 字符串 | 集合
  4. SQL 最基本使用
  5. nodejs之process进程
  6. [原] XAF 如何基于业务规则禁用属性
  7. Tomcat热部署和虚拟目录配置
  8. FM000
  9. 【Sass初级】开始使用Sass和Compass
  10. OpenMP多线程linux下的使用,简单化
  11. java学习面向对象之static内存图解
  12. ActiveMQ之topic主题模式
  13. AlexNet卷积神经网络【前向反馈】
  14. qianduan
  15. restful规范快速记忆
  16. base64加密和解码原理和代码
  17. java加载配置文件信息
  18. 第3章 文件I/O(6)_高级文件操作:文件锁
  19. POJ 2395 Out of Hay(求最小生成树的最长边+kruskal)
  20. cat命令和EOF标识输出shell到文件

热门文章

  1. WPF中退出时显示是否保存数据提示
  2. python_111_动态导入模块
  3. LeetCode || 双指针 / 单调栈
  4. https 调用验证失败 peer not authenticated
  5. centos6 安装windows字体
  6. 老男孩Python高级全栈开发工程师【真正的全套完整无加密】
  7. vue+axios+promise实际开发用法
  8. Web框架之Django_04 模板层了解(过滤器、标签、自定义过滤器、标签、inclusion_tag、模板的继承与导入)
  9. python--第一类对象,函数名,变量名
  10. django基础(web框架,http协议,django安装)