response如何传递数据
login.htm
<body>
<form method= "post " action= "Default.aspx? " >
<input id= "txtUserName " type= "text " /> <br />
<input id= "txtUserPwd " type= "text " /> <br />
<input id= "Submit1 " type= "submit " value= "submit " />
</form>
</body>
default.aspx
protected void Page_Load(object sender, EventArgs e)
{
if (Request[ "txtUserName "] != null && Request[ "txtUserPwd "] != null)
{
string userName = Request[ "txtUserName "].ToString();
string userPwd = Request[ "txtUserPwd "].ToString();
Response.Write( "登录的用户名为 " + userName + "登录的密码为 " + userPwd);
}
}
哪里错了?为什么运行的时候,default.aspx里一片空白呀?
------解决方案-------------------- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN " "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<html xmlns= "http://www.w3.org/1999/xhtml " >
<head>
<title> Untitled Page </title>
</head>
<body>
<form method= "post " action= "Default.aspx? " >
<input id= "txtUserName " name= "txtUserName " type= "text " /> <br />
<input id= "txtUserPwd " name = "txtUserPwd " type= "text " /> <br />
<input id= "Submit1 " type= "submit " value= "submit " />
</form>
</body>
</html>
-----------
测试通过