纯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 method="post" action="Default.aspx" lang="zh-cn">
    <table cellpadding="0" cellspacing="0" border="0"  align="center">
        <tr>
            <td style="width: 70px; height: 35px">
                用 户 名:</td>
            <td style="width: 195px; height: 35px">
                <input id="Text1" type="text" name="txtUseName" /></td>
        </tr>
        <tr>
            <td style="width: 70px; height: 32px">
                密&nbsp; &nbsp;&nbsp; &nbsp; &nbsp;码:</td>
            <td style="width: 195px; height: 32px">
                <input id="Text2" type="text" name="txtUsePwd" /></td>
        </tr>
        <tr>
         <td colspan="2" align="center" style="height: 26px">
             <input id="Submit1" style="width: 72px" type="submit" value="提 交" name="Login" /></td>
        </tr>
    </table>
</form>
</body>
</html>

ASP.NET页面:

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        //string UseName = Request["txtUseName"].ToString();------------------------post  方法1
        //string UsePwd = Request["txtUsePwd"].ToString();
        string UseName = Request.Form.Get("txtUseName").ToString();---------------post  方法2
        string UsePwd = Request.Form.Get("txtUsePwd").ToString();
        //string UseName = Request.QueryString["txtUseName"].ToString();-----------get    方法1
        //string UsePwd = Request.QueryString["txtUsePwd"].ToString();
        Response.Write("你的用户名为:" + UseName + "---密码为:" + UsePwd);
       
    }
}
posted on 2006-11-05 16:42  小角色  阅读(538)  评论(0)    收藏  举报