这是一个HTML页面:
<form method="post" id="form1" action="Default.aspx">
<center>
<table cellpadding="0" cellspacing="0" style="width: 408px; height: 96px">
<tr>
<td style="width: 256px; height: 22px">
</td>
<td style="width: 674px; height: 22px;">
<input id="txtUserName" style="width: 168px" type="text" /></td>
<td style="width: 133px; height: 22px;">
</td>
</tr>
<tr>
<td style="width: 256px">
</td>
<td style="width: 674px">
<input id="txtUserPwd" style="width: 168px" type="text" /></td>
<td style="width: 133px">
</td>
</tr>
<tr>
<td style="width: 256px">
</td>
<td style="width: 674px">
<input id="Submit1" type="submit" value="提 交" /></td>
<td style="width: 133px">
</td>
</tr>
</table>
</center>
</form>
这是调用的页面,怎么总是提示出错啊?
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
this.txtusername.Text = "";
this.txtuserpwd.Text = "";
}
this.btnclose.Attributes.Add("onclick", "window.close();");
//string userName = Request[txtusername.Text].ToString();
//String userPwd = Request[txtuserpwd.Text].ToString();
string userName = Request.Form.Get(txtusername).ToString;
string userPwd = Request.Form.Get(txtuserpwd).ToString;
Response.Write("你的用户名是" + userName + "密码是:" + userPwd);
}
protected void btnLogin_Click(object sender, EventArgs e)
{
if (this.txtusername.Text == "a" && this.txtuserpwd.Text == "a")
{
lblmessage.Text = "登录成功";
}
else
{
lblmessage.Text = "登录失败";
this.txtusername.Focus();
}
}
protected void btnclear_Click(object sender, EventArgs e)
{
this.txtusername.Text = "";
this.txtuserpwd.Text = "";
}
}