<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
<form method="post" action="SelfAdd.ashx">
<input type="text" name="num" value="$num" />
<input type="submit" name="name" value="计算" />
<input type="hidden" name="hidden" value="$num" />
</form>
</body>
</html>
<%@ WebHandler Language="C#" Class="SelfAdd" %>
using System;
using System.Web;
public class SelfAdd : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/html";
string filePath = context.Request.MapPath("SelfAdd.html");
string content = System.IO.File.ReadAllText(filePath);
int num = Convert.ToInt32(context.Request.Form["hidden"]);
num++;
content = content.Replace("$num", num.ToString());
context.Response.Write(content);
}
public bool IsReusable {
get {
return false;
}
}
}