登录页面Login.aspx
<form id="form1" action="Login.aspx" method="post" runat="server">
<input type="text" id="UserName"/>
<input type="text" id="Pwd" />
<input type="submit" value="登录"/>
</form>
后台Login.aspx.cs
if (IsPostBack)
{
string user = Request.Form["UserName"];
if (!string.IsNullOrEmpty(user))
{
Session["UserName"] = user;
Response.Redirect("Default.aspx");
}
}
当我输入用户名和密码,点击【登录】按钮时,请求报文里根本没有数据提交过去