Tôi đang cố gắng theo dõi số example này về cách xác thực bằng chứng xác thực. Tuy nhiên, nó sử dụng asp: điều khiển cho biểu mẫu đăng nhập.Cách truy cập các điều khiển html trong mã phía sau
Nếu tôi được sử dụng điều khiển html thay vì phong cách CSS có thể được áp dụng, ví dụ như
<div id="login">
<a href="#" id="lclose"></a>
<form action="#" runat="server">
<fieldset>
<div class="frame">
<h4>Login</h4>
<small>Sign in to your account.</small>
<div class="clear"></div>
<input type="text" value="Username" class="input-text autoclear" />
<input type="password" value="Password" class="input-text autoclear"/>
</div>
<div class="separator"></div>
<div>
<input type="submit" value="Sign in" class="input-submit float-right" runat="server" onserverclick="LoginButton_Click"/>
<a href="#" class="float-left">Forgot your password?</a>
</div>
</fieldset>
</form>
</div>
Làm thế nào để truy cập vào Username & Password trong mã đằng sau giống với?
protected void LoginButton_Click(object sender, EventArgs e)
{
// Validate the user against the Membership framework user store
if (Membership.ValidateUser(UserName.Text, Password.Text))
{
// Log the user into the site
FormsAuthentication.RedirectFromLoginPage(UserName.Text, RememberMe.Checked);
}
// If we reach here, the user's credentials were invalid
InvalidCredentialsMessage.Visible = true;
}
Cú pháp chính xác thay vì UserName.Text, Password.Text
là gì?