我正在开发一个已经构建并且工作正常的项目。我现在需要做的是用盐加密密码。通常我可以做到这一点,但我很难看到控制 asp:Login 的位置用户名和密码。我已经搜索了整个项目,但找不到从数据库中检索用户名和密码的位置以及检查是否正确的任何详细信息。这里是标记:
<asp:Login ID="LoginUser" runat="server" EnableViewState="False" RenderOuterTable="False" OnLoggingIn="LoginUser_LoggingIn">
<LayoutTemplate>
<div class="accountInfo">
<fieldset class="Login">
<p>
<asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName" CssClass="text"></asp:Label>
<asp:TextBox ID="UserName" runat="server" CssClass="textEntry"></asp:TextBox>
<asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
CssClass="failureNotification" ErrorMessage="User Name is required." ToolTip="User Name is required."
ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>
</p>
<p>
<asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password" CssClass="text"></asp:Label>
<asp:TextBox ID="Password" runat="server" CssClass="passwordEntry" TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
CssClass="failureNotification" ErrorMessage="Password is required." ToolTip="Password is required."
ValidationGroup="LoginUserValidationGroup">*</asp:RequiredFieldValidator>
</p>
</fieldset>
<span class="error">
<asp:Literal ID="FailureText" runat="server"></asp:Literal>
</span>
<asp:ValidationSummary ID="LoginUserValidationSummary" runat="server" CssClass="error"
ValidationGroup="LoginUserValidationGroup" />
<p class="submitButton">
<asp:Button CssClass="submitButton" ID="LoginButton" runat="server" CommandName="Login"
ValidationGroup="LoginUserValidationGroup" Text="d" OnClick="LoginButton_Click" />
</p>
</div>
</LayoutTemplate>
</asp:Login>
这里是代码隐藏:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using mycompany.BaseCode;
using System.Threading;
namespace mycompany.Account
{
public partial class Login : BasePage
{
protected void Page_Load(object sender, EventArgs e)
{
//RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);
Thread.CurrentThread.CurrentCulture = new System.Globalization.CultureInfo(SessionManager.Culture);
lblLoginTitle.Text = Resources.Login.LoginTitle;
lblExtraInfo.Text = Resources.Login.ExtraInfo;
var llb = (Label)LoginUser.FindControl("UserNameLabel");
llb.Text = Resources.Login.Username;
llb = (Label)LoginUser.FindControl("PasswordLabel");
llb.Text = Resources.Login.Password;
LoginUser.FailureText = Resources.Login.FailureText;
var rfv = (RequiredFieldValidator)LoginUser.FindControl("PasswordRequired");
rfv.ErrorMessage = Resources.Login.PasswordRequired;
rfv = (RequiredFieldValidator)LoginUser.FindControl("UserNameRequired");
rfv.ErrorMessage = Resources.Login.UsernameRequired;
var btn = (Button)LoginUser.FindControl("LoginButton");
btn.Text = Resources.Login.btnLogin;
}
}
}
在任何地方都找不到 OnLoggingIn="LoginUser_LoggingIn" 或 OnClick="LoginButton_Click" 事件。我什至查看了基本代码。有趣的是它正在工作。任何关于在哪里可以找到这些隐藏细节的解释或提示将不胜感激