string content = System.IO.File.ReadAllText(filepath);
content = content.Replace("@value",value);
context.Response.Write(content);
}
html
<form action="addTest.ashx" method="post">
<input type="hidden" name="ispostBack" value="true" />
<input type="hidden" name="num_01" value="@value" />
<div>@value
</div>
<input type="submit" name="" value="addOne" />
</form>
5、cookie
服务器返回数据除了一般html数据,还有cookie,浏览器会把cookie值更新到本地浏览器,可能会消耗太多资源
//www.jb51.net 所以网站的图片服务器会和主站域名不同,减少cookie流量传输,以优化网站速率: http://www.myblogs.com/daomul.gif
6、每次请求都会new一个新的IhttpHandler接口的类“变量1”的实例进行处理
用完就GC掉,不会保持上次的值
用static “保存”,所有访问者都会访问的实例
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class vivideo_test_变量1 : System.Web.UI.Page
{
private int i = 0;
private static int j = 0;
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
//i++;
//Label1.Text = i.ToString();
j++;
Label1.Text = j.ToString();
}
}








