有关登录控制的信息. [英] info about login control..

查看:63
本文介绍了有关登录控制的信息.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

protected void ctlLogin_Authenticate(object sender, AuthenticateEventArgs e)
    {
        bool Authenticated = false;

        Authenticated = UserAuthenticate(ctlLogin.UserName, ctlLogin.Password);
        e.Authenticated = Authenticated;
       if (Authenticated == true)
        {


            Response.Redirect("information1.aspx");

       }
    }

    private bool UserAuthenticate(string UserName, string Password) what this fuction do?
    {
       bool boolReturnValue = false;  what this line do?  
        //--------------------------------
        //Check UserID From Config File

            //--------------------------------
            dt = new DataTable();
            SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Users\omar\Documents\Visual Studio 2005\WebSites\Project1\App_Data\Database.mdf;Integrated Security=True;User Instance=True");
            string chkUser = "Select * FROM [User] where Email='" + UserName + "' AND Password='" + Password + "'";
            dt = dbClass.ConnectDataBaseReturnDT(chkUser);
            if (dt.Rows.Count > 0)
            {
                boolReturnValue = true; what this line do?
                Session["Id"] = dt.Rows[0]["Id"].ToString();
               string que = "UPDATE [User] SET LastLogin = GETDATE() where Id=" + Session["Id"].ToString();
              //  DateTime registerdate = (DateTime)dt.Rows[0]["RegisterDate"];
               // string que1 = "UPDATE [User] SET RegisterDate = GETDATE() where Id=" + Session["UserId"].ToString();
               dbClass.ConnectDataBaseToInsert(que);
                //dbClass.ConnectDataBaseToInsert(que1);
           }
           return boolReturnValue; what this line do?



    }




请告诉我这段代码的执行顺序是什么
私人布尔UserAutenicate(String UserName,String Password)

字符串用户名和密码从哪里获取值?




plz tell me about what is the sequence of execution of this code
private bool UserAutenicate(String UserName,String Password)

String UserName and Password Gets values form Where?

推荐答案

我认为您应该读一两本书.您的问题的答案非常明显.如果您的角色是公司中的.Net开发人员,请告诉他们您不是.如果您是学生,请尝试以下操作:

在代码的以下行上放置一个断点:

I think you should read a book or two. Answers to your questions are quite evident. If your role is of a .Net developer in company, tell them you are not one. If you are a student, try following:

Put a break point at the following line in your code:

bool Authenticated = false;



单步执行并进入代码(使用F11进行调试,而不使用F10).这应该可以帮助您了解其工作原理.

希望这会有所帮助.



Step through and into the code (use F11 to debug and not F10). This should help you understand how this works.

Hope this helps.


这篇关于有关登录控制的信息.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆