login.htm
<!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>无标题页</title>
</head>
<body>
<form action ="Default.aspx" method ="post" >
姓名:<input id="Text1" name="Name" type="text" /><br />
密码: <input id="Text2" name="Pwd" type="text" />
<br />
<input id="Submit1" type="submit" value="submit" />
<input id="Reset1" type="reset" value="reset" />
</form>
</body>
</html>
<!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>无标题页</title>
</head>
<body>
<form action ="Default.aspx" method ="post" >
姓名:<input id="Text1" name="Name" type="text" /><br />
密码: <input id="Text2" name="Pwd" type="text" />
<br />
<input id="Submit1" type="submit" value="submit" />
<input id="Reset1" type="reset" value="reset" />
</form>
</body>
</html>
default.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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 runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
用户名:<asp:Label ID="lblName" runat="server" Text =<%#name %>></asp:Label><br />
密码:<asp:Label ID="lblPwd" runat="server" Text =<%#pwd %>></asp:Label></div></form>
</body>
</html>
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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 runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
用户名:<asp:Label ID="lblName" runat="server" Text =<%#name %>></asp:Label><br />
密码:<asp:Label ID="lblPwd" runat="server" Text =<%#pwd %>></asp:Label></div></form>
</body>
</html>
default.aspx.cs
public partial class _Default : System.Web.UI.Page
{
public string name = "";
public string pwd = "";
protected void Page_Load(object sender, EventArgs e)
{
name = Request["Name"];
pwd = Request["Pwd"];
DataBind();
}
}
public partial class _Default : System.Web.UI.Page
{
public string name = "";
public string pwd = "";
protected void Page_Load(object sender, EventArgs e)
{
name = Request["Name"];
pwd = Request["Pwd"];
DataBind();
}
}
这里要注意的是,name和pwd的声明