请问一下这句话到底是干嘛的呢? sb.Append("<input type='hidden' name='hiddenIsPostBack' value='1' />");
求解啊,谢谢
<%@ WebHandler Language="C#" Class="_06Caculate" %>
using System;
using System.Web;
using System.Text;
public class _06Caculate : IHttpHandler {
public void ProcessRequest (HttpContext context) {
string Num1 = context.Request.Form["txtNum1"];
string Num2 = context.Request.Form["txtNum2"];
int x = 0;
int y = 0;
int z = 0;
if (!string.IsNullOrEmpty("hiddenIsPostBack"))
{
if (!string.IsNullOrEmpty(Num1) && !string.IsNullOrEmpty(Num2))
{
if (int.TryParse(Num1, out x) && int.TryParse(Num2, out y))
{
z = x + y;
}
}
}
else
{
}
StringBuilder sb = new StringBuilder();
sb.Append("<form action='' method='post'>");
sb.Append("<html><head><title>计算器</title></head><body>");
sb.Append("<input type='text' name='txtNum1' value='" + x.ToString() + "'/>");
sb.Append("<input type='text' name='txtNum2' value='" + y.ToString() + "'/> <br> =");
sb.Append("<input type='text' name='txtSum' value='" + z.ToString() + "'/> ");
sb.Append("<input type='submit' name='submit' value='计算'/>");
sb.Append("<input type='hidden' name='hiddenIsPostBack' value='1' />");
sb.Append("<a href='04Register.ashx?a=james'>注册</a>");
sb.Append("</form>");
sb.Append("</body></html>");
context.Response.Write(sb.ToString());
}
public bool IsReusable {
get {
return false;
}
}
} |