ASP POST请求

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
<meta charset="utf-8" />
</head>
<body>
    <form method="post" 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.Form["txtName"];
        string userPwd = context.Request.Form["txtPwd"];

        context.Response.Write("您输入的用户名为" + userName + " 密码为" + userPwd);
    }


    public bool IsReusable {
        get {
            return false;
        }
    }


}

原文地址:https://www.cnblogs.com/dxmfans/p/9434761.html