我的这个提交怎么不显示用户名和密码?急啊 !

来源:百度知道 编辑:UC知道 时间:2024/06/07 00:58:57
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ {

string username = Request["txtusername.Text"] != null ? Request["txtusername.Text"].ToString() : "";

string userpwd = Request["txtuserpwd.Text"] != null ? Request["txtuserpwd.Text"].ToString() : "";

Response.Write("登录的用户名为" + username + ";密码为" + userpwd);
在login.html里 是 <form method="post" action="webform1.aspx"></form> 而 运行之后显示的是
登录的用户名为;密码为 就是出不来用户名和密码。
前两个都试过了。不行啊</script>
</head>
<body>
<form method="post" action="webform1.aspx">
<input id="txtusername" style="z-index: 100; left: 165px; position: absolute; top: 50px"
type="text" />
<input id=&qu

改为:
string username =txtusername.Text!= null ?txtusername.Text: "";

string userpwd = txtuserpwd.Text != null ?txtuserpwd.Text : "";

Request["txtusername.Text"] 改成 txtusername.Text的ID名称

在页面上加个label控件,将"登录的用户名为" + username + ";密码为" + userpwd给他,看看能显示不?