今天試了一下用request獲取form中值的方法,跟asp還是有點不一樣,總結了兩種方法:
第一種:
(post)
string userName = Request["txtUserName"].ToString();
string passWord = Request["txtUserPwd"].ToString();
第二種:
(post)
string userName = Request.Form.Get("txtUserName").ToString();
string passWord = Request.Form.Get("txtUserPwd").ToString();
(get)
string userName = Request.QueryString["txtUserName"].ToString();
string passWord = Request.QueryString["txtUserPwd"].ToString();