//EditUserInfo.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<meta charset="utf-8" />
</head>
<body>
<form action="UpdateUserInfo.ashx" method="post">
<input type="hidden" name="txtId" value="$UserId" />
用户名:<input type="text" name="txtName" value="$UserName" /><br />
密码:<input type="text" name="txtPwd" value="$UserPwd" /><br />
<input type="submit" name="name" value="修改" />
</form>
</body>
</html>
/***************************************************************************************************/
//EditUserInfo.ashx
<%@ WebHandler Language="C#" Class="EditUserInfo" %>
using System;
using System.Web;
using System.Data;
using System.Data.SqlClient;
public class EditUserInfo : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/html";
string id = context.Request.QueryString["UserId"];
string name = context.Request.QueryString["UserName"];
string pwd = context.Request.QueryString["UserPwd"];
string filePath = context.Request.MapPath("EditUserInfo.html");
string fileContent = System.IO.File.ReadAllText(filePath);
fileContent = fileContent.Replace("$UserId", id).Replace("$UserName", name).Replace("$UserPwd", pwd);
context.Response.Write(fileContent);
}
public bool IsReusable {
get {
return false;
}
}
}