-2

有一些像这样的html

<form>
user: <input type="text" name="firstname"><br>
pw  : <input type="text" name="lastname"><br>
<input type="submit" value="Submit">
</form>

和 ac# 方法来评估

 string uname = "Bob";
 string pass = "bigballs"; 

 public void Authenticate(string username, string pw)
 {
     if (username == uname && pw == pass)
     {
         /// go to admin area
     }
 }

我想知道的是该服务器方法如何访问该表单数据?

4

1 回答 1

1

像这样在 asp.net

<form>
user: <input type="text" name="firstname" Id= "firstname"><br>
pw  : <input type="text" name="lastname" Id = "lastname"><br>
<input type="submit" value="Submit">
</form>


string strFirstName =  Request.Form["firstname"];
string strLastName =  Request.Form["lastname"];
于 2013-05-21T05:09:10.203 回答