<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<meta charset="utf-8" />
</head>
<body>
<form method="get" action="Accept.ashx">
用户名:<input type="text" name="txtName" value="" /><br />
密 码: <input type="password" name="txtPwd" value="" /><br />
<button type="submit">提交</button>
</form>
</body>
</html>
<%@ WebHandler Language="C#" Class="Accept" %>
using System;
using System.Web;
public class Accept : IHttpHandler {
public void ProcessRequest (HttpContext context) {
context.Response.ContentType = "text/plain";
string userName = context.Request.QueryString["txtName"];
string userPwd = context.Request.QueryString["txtPwd"];
context.Response.Write("您输入的用户名为" + userName + " 密码为" + userPwd);
}
public bool IsReusable {
get {
return false;
}
}
}