I can't find ASP login control's code behind

2.1k Views Asked by At

I have a web application for debugging.

It has a login page with an ASP.NET login control, but there is nothing in its code behind. I want to find the data access layer where checking username and password correctness:

<asp:Login ID="Login1" runat="server"
    onloggedin="Login1_LoggedIn" DestinationPageUrl="~/frmMain.aspx"
    DisplayRememberMe="False"
    FailureText="مشخصات وارد شده معتبر نيست. نام کاربري يا رمز عبور اشتباه است"
    LoginButtonImageUrl="~/images/ok.gif" LoginButtonText="تائيد"
    LoginButtonType="Image" PasswordLabelText="کلمه عبور:"
    PasswordRequiredErrorMessage="کلمه عبور را وارد کنيد"
    UserNameLabelText="شناسه کاربر:"
    UserNameRequiredErrorMessage="شناسه کاربر را وارد کنيد" TitleText="فرم ورود به سيستم" Font-Size="10pt"
>
    <InstructionTextStyle Font-Italic="True" ForeColor="Black" Height="20px"
                          HorizontalAlign="Right" Width="150px" Wrap="False" />
    <LabelStyle Height="30px" HorizontalAlign="Right" />
    <LoginButtonStyle BackColor="#FFFBFF" BorderColor="#CCCCCC" BorderStyle="Solid"
                      BorderWidth="1px" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284775" />
    <TextBoxStyle Font-Size="10pt" Width="150px" />
    <TitleTextStyle Font-Bold="True" Font-Size="10pt"
                    ForeColor="#556C8C" Height="30px" />
</asp:Login>

And the other side is:

protected void Page_Load(object sender, EventArgs e)
{
    Login1.Focus();
}

protected void ImageButtonImageButtonLogin_Click(object sender, ImageClickEventArgs e)
{

}

protected void Login1_LoggedIn(object sender, EventArgs e)
{
    SIC.Jazb.BLL.UserLogBusinessRules.SaveLog(1, "كاربر با شناسه  " + Login1.UserName + " وارد شد.", "", "", "", Login1.UserName);

    //BLLCommon.CUserLog.SaveLog(ActionTypeEnum.Login, Utility.TBL_LOGIN, "كاربر با شناسه  " + Utility.getCurretUserName() + " وارد شد.", Utility.getCurretUserId(), 0);

    //BLLCommon.CUserLog.SaveLog(ActionTypeEnum.Other, "--", "ورود نا موفق كاربر با شناسه " + txtUserID.Text + " به دليل كلمه عبور اشتباه " + txtPassword.Text, Convert.ToInt64(ocDataSet.Tables[0].Rows[0]["PKId"]), 0);
    //BLLCommon.CUserLog.SaveLog(ActionTypeEnum.Other, "--", "ورود نا موفق كاربر با شناسه " + txtUserID.Text + " به دليل فعال نبودن " + txtPassword.Text, Convert.ToInt64(ocDataSet.Tables[0].Rows[0]["PKId"]), 0);
    //BLLCommon.CUserLog.SaveLog(ActionTypeEnum.Other, "--", "ورود ناموفق به دليل شناسه كاربري اشتباه " + txtUserID.Text, 0, 0);
}

protected void Login1_LoginError(object sender, EventArgs e)
{
    SIC.Jazb.BLL.UserLogBusinessRules.SaveLog((int)ActionTypeEnum.Other, "ورود نا موفق كاربر با شناسه " + Login1.UserName , "", "", "","");
}

Now I want to find anywhere that username and password are checking.

2

There are 2 best solutions below

0
Pouya Samie On

Check this out: Login control FAQ. It should solve your problems :)

Based on Microsoft MSDN, the provider handles login, and you can change it, but by default it creates a database and uses it so:

The Login control displays a user interface for user authentication. The Login control contains text boxes for the user name and password and a check box that allows users to indicate whether they want the server to store their identity using ASP.NET membership and automatically be authenticated the next time they visit the site.

The Login control has properties for customized display, for customized messages, and for links to other pages where users can change their password or recover a forgotten password. The Login control can be used as a standalone control on a main or home page, or you can use it on a dedicated login page.

If you use the Login control with ASP.NET membership, you do not need to write code to perform authentication. However, if you want to create your own authentication logic, you can handle the Login control's Authenticate event and add custom authentication code.

0
Javid On

There is an event called Authenticate. Write your own customized authentication and authorization there. Like this:

protected void Login_Authenticate(object sender, AuthenticateEventArgs e)
{
    if (Authentication.IsAuthenticate(Config.ADDomain, LoginCtrl.UserName, LoginCtrl.Password) &&
        Authentication.IsAuthorized(Config.ADDomain, LoginCtrl.UserName))
    {
        Session.Add("IsAuthenticated", true);
        Session.Add("UserName", LoginCtrl.UserName);

        Response.Redirect("AddressValidatorMain.aspx");
    }
    else
    {
        Session.Add("IsAuthenticated", false);
    }
}