form之get/post

.net2.0  VS2005
一、login.aspx :  <FORM action="main.aspx" method="post">
         main.aspx:   string userName=Request["userName"].ToString();
                               string userPwd=Request["userPwd"].ToString();
                              -------------------------------------------------------------------------
                               string userName=Request.Form.Get("userName").ToString();
                               string userPwd=Request.Form.Get("userPwd").ToString();
二、login.aspx:<FORM action="main.aspx" method="get">
        main.aspx: string userName=Request.QueryString["userName"].ToString();
                            string userPwd=Request.QueryString["userPwd"].ToString();
     不同之处:使用get方法则会显示为main.aspx?userName=xxxx&userPwd=xxxx;
                           使用post方法则作为一个form传递
   
                           
 
 

你可能感兴趣的:(职场,休闲)