當前位置: 首頁>>代碼示例>>C#>>正文


C# WebControls.AuthenticateEventArgs類代碼示例

本文整理匯總了C#中System.Web.UI.WebControls.AuthenticateEventArgs的典型用法代碼示例。如果您正苦於以下問題:C# AuthenticateEventArgs類的具體用法?C# AuthenticateEventArgs怎麽用?C# AuthenticateEventArgs使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AuthenticateEventArgs類屬於System.Web.UI.WebControls命名空間,在下文中一共展示了AuthenticateEventArgs類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: UserAuthenticate

        protected void UserAuthenticate(object sender, AuthenticateEventArgs e)
        {
            if (Membership.ValidateUser(this.LoginForm.UserName, this.LoginForm.Password))
            {
                e.Authenticated = true;
                return;
            }

            string url = string.Format(
                this.ForumAuthUrl,
                HttpUtility.UrlEncode(this.LoginForm.UserName),
                HttpUtility.UrlEncode(this.LoginForm.Password)
                );

            WebClient web = new WebClient();
            string response = web.DownloadString(url);

            if (response.Contains(groupId))
            {
                e.Authenticated = Membership.ValidateUser("Premier Subscriber", "danu2HEt");
                this.LoginForm.UserName = "Premier Subscriber";

                HttpCookie cookie = new HttpCookie("ForumUsername", this.LoginForm.UserName);
                cookie.Expires = DateTime.Now.AddMonths(2);

                Response.Cookies.Add(cookie);
            }
        }
開發者ID:mrkurt,項目名稱:mubble-old,代碼行數:28,代碼來源:Login.aspx.cs

示例2: Login1_Authenticate

        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            string userName = this.Login1.UserName;
            string pwd = this.Login1.Password;

            // admin login
            //
            if (userName == "admin")
            {
                if (pwd == "admin")
                {
                    //WaterUserLevel level = WaterUserLevelFactory.CreateWaterLevel(WaterUserLevelEnum.Ju);
                    ////SessionManager.WaterUserSession.WaterUser = WaterUserFactory.CreateWaterUser(level);
                    //SessionManager.LoginSession.WaterUser = WaterUserFactory.CreateWaterUser(level);
                    e.Authenticated = true;
                }
                return;
            }

            //int userID, waterUserID;
            //bool b = UserDBI.CanLogin(userName, pwd, out userID, out waterUserID);

            ////if (b)
            ////{
            ////    LoginSession ls = SessionManager.LoginSession;
            ////    ls.LoginUserName = userName;
            ////    ls.LoginUserID = userID;
            ////    ls.WaterUser = WaterUserFactory.CreateWaterUserByID(waterUserID);
            ////}

            //e.Authenticated = b;
            //Trace.Warn("authenticate : " + b.ToString());
        }
開發者ID:hkiaipc,項目名稱:yh,代碼行數:38,代碼來源:login.aspx.cs

示例3: login_Authenticate

        protected void login_Authenticate(object sender, AuthenticateEventArgs e)
        {
            string lgn = login.UserName;
            string pass = login.Password;

            e.Authenticated = SecurityService.SecurityServiceInstance.Login(lgn, pass);
        }
開發者ID:RoykoSerhiy,項目名稱:visualStudio_projects,代碼行數:7,代碼來源:LoginPage.aspx.cs

示例4: Login1_Authenticate

 protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
 {
     if (Login1.Password.Equals("dcwj")&&Login1.UserName.Equals("admin"))
     {
         Response.Redirect("index.aspx");
     }
 }
開發者ID:conghuiw,項目名稱:dcwj,代碼行數:7,代碼來源:Default.aspx.cs

示例5: AuthenticateUser

        protected void AuthenticateUser(object sender, AuthenticateEventArgs e)
        {
            SqlConnection con = new SqlConnection(connection);
            SqlCommand cmd = new SqlCommand("spAuthenticateUser1", con);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@email", ctrlLogin.UserName);
            cmd.Parameters.AddWithValue("@password", ctrlLogin.Password);
            con.Open();
            int value = Convert.ToInt32(cmd.ExecuteScalar());
            //    con.Close();
            if (value == 1)
            {
                Session["Username"] = ctrlLogin.UserName;
                FormsAuthentication.RedirectFromLoginPage(ctrlLogin.UserName, false);
                string sqlquery = "select CustomerID from [SalesLT].[Customer] where EmailAddress = '" + ctrlLogin.UserName + "' ";
                SqlCommand cmd1 = new SqlCommand(sqlquery, con);
                int CustomerID = Convert.ToInt32(cmd1.ExecuteScalar());
                Session["customerId"] = CustomerID;

                string sqlquery1 = "select AddressID from [SalesLT].[CustomerAddress] where CustomerID = '" + CustomerID + "' ";
                SqlCommand cmd2 = new SqlCommand(sqlquery1, con);
                int AddressID = Convert.ToInt32(cmd2.ExecuteScalar());
                Session["AddressId"] = AddressID;

                Dictionary<int,int> cartItems=new Dictionary<int,int>();
                Session["shoppingCart"]=cartItems;
            }
        }
開發者ID:vgopu2,項目名稱:BISummer2015-P1-T1,代碼行數:28,代碼來源:Login.aspx.cs

示例6: Login_Authenticate

        protected void Login_Authenticate(object sender, AuthenticateEventArgs e)
        {
            String login = Login.UserName;
            String senha = Login.Password;

            try
            {
                Usuario usr = new Usuario(login, senha);
                if (usr.LoginUsuario())
                {
                    e.Authenticated = true;
                    Session["nome"] = usr.nome;
                    if (usr.getID() == 0)
                    {
                        Session["tipo"] = "Administrador";
                        Login.DestinationPageUrl = "~/Interface/AdministradorMenu.aspx";
                    }
                    else
                    {
                        Session["tipo"] = "Jogador";
                        Session["Id"] = Convert.ToString(usr.getID());
                        Login.DestinationPageUrl = "~/Interface/JogadorMenu.aspx";
                    }
                    FormsAuthentication.RedirectFromLoginPage(usr.nome, false);
                }
                else
                {
                    e.Authenticated = false;
                }
            }
            catch
            {
            }       
        }
開發者ID:anderson-uchoa,項目名稱:showperguntas,代碼行數:34,代碼來源:Home.aspx.cs

示例7: Login1_Authenticate

 protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
 {
     if (Login1.UserName.CompareTo("") == 0 || Login1.Password.CompareTo("") == 0)
         e.Authenticated = false;
     else
     {
         try
         {
             if (LoginOperations.AdminAuthentication(Login1.UserName, Login1.Password))
             {
                 e.Authenticated = true;
                 Session["Username"] = Login1.UserName;
                 Session["AdminRights"] = true;
                 Response.Redirect("AdminHome.aspx");
             }
             else if (LoginOperations.StudentAuthentication(Login1.UserName, Login1.Password))
             {
                 e.Authenticated = true;
                 Session["Username"] = Login1.UserName;
                 Session["AdminRights"] = false;
                 Response.Redirect("StudentHome.aspx");
             }
             else
             {
                 e.Authenticated = false;
                 //lblStatus.Text = "Enter Valid UserName and Password";
             }
         }
         catch (Exception execption)
         {
             e.Authenticated = false;
             //lblStatus.Text = "Enter Valid UserName and Password";
         }
     }
 }
開發者ID:jaskarans-optimus,項目名稱:Induction,代碼行數:35,代碼來源:Login.aspx.cs

示例8: login_Authenticate

 protected void login_Authenticate(object sender, AuthenticateEventArgs e)
 {
     e.Authenticated = FormsAuthentication.Authenticate(login.UserName, login.Password);
     if (e.Authenticated) {
         FormsAuthentication.RedirectFromLoginPage(login.UserName, login.RememberMeSet);
     }
 }
開發者ID:frenzypeng,項目名稱:securityswitch,代碼行數:7,代碼來源:Login.aspx.cs

示例9: LoginForm_Authenticate

        protected void LoginForm_Authenticate(object sender, AuthenticateEventArgs e)
        {
            MWRClientLib.ClientProxy proxy = new MWRClientLib.ClientProxy(new MWRClientLib.ClientInterface.ClientInterfaceSoapClient("ClientInterfaceSoap"));
            ProxyServer.BusinessLayer.ClientAuthStruct auth = new ProxyServer.BusinessLayer.ClientAuthStruct();
            auth.UserName = LoginForm.UserName;
            auth.Password = LoginForm.Password;
            try
            {
                ProxyServer.BusinessLayer.UserDataResponse response = proxy.GetUserData(auth);
                if (response.ErrorCode == 0)
                {
                    e.Authenticated = true;
                    List<MWRCommonTypes.MachineWithPrivilleges> machines = new List<MWRCommonTypes.MachineWithPrivilleges>();

                    foreach (MWRCommonTypes.MachineWithPrivilleges mach in response.MachinesList)
                    {
                        machines.Add(mach);
                    }

                    MWRCommonTypes.User loggedUser = new MWRCommonTypes.User();
                    loggedUser = response.User;
                    loggedUser.Password = auth.Password;
                    Session["LoggedUser"] = loggedUser;
                    Session["Machines"] = machines.ToArray();
                    Response.Redirect("Default.aspx");
                }
                LoginForm.FailureText = "Nie udało się zalogować. Kod błędu " + response.ErrorCode.ToString();
            }
            catch (Exception exc)
            {
                LoginForm.FailureText = "Nie udało się zalogować. Wystąpił wewnętrzny błąd serwera." + exc.ToString();
            }
        }
開發者ID:macper,項目名稱:MWRWebRemoter,代碼行數:33,代碼來源:Logon.aspx.cs

示例10: LoginUser_Authenticate

        protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
        {
            if (LoginUser.UserName.Contains("@")) //validação por email
            {
                string username = Membership.GetUserNameByEmail(LoginUser.UserName);

                if (username != null)
                {

                    if (Membership.ValidateUser(username, LoginUser.Password))
                    {
                        LoginUser.UserName = username;
                        e.Authenticated = true;
                    }
                    else
                    {
                        e.Authenticated = false;
                    }
                }
            }
            else // validação username normal
            {
                if (Membership.ValidateUser(LoginUser.UserName, LoginUser.Password))
                    e.Authenticated = true;
                else
                    e.Authenticated = false;
            }
        }
開發者ID:deftnesssolutions,項目名稱:AxadoTest,代碼行數:28,代碼來源:Login.aspx.cs

示例11: Login_Authenticate

 protected void Login_Authenticate(object sender, AuthenticateEventArgs e)
 {
     SqlCommand com = new SqlCommand("Select * from User_Info", con);
     SqlDataReader dr;
     con.Open();
     dr = com.ExecuteReader();
     while (dr.Read())
     {
         if (Login.UserName == dr["UserID"].ToString() && Login.Password == dr["Password"].ToString())
         {
             DataSet ds = new DataSet();
             ds = obj.Data_inventer("select FName from User_Info where UserID='" + Login.UserName + "'");
             String name = ds.Tables[0].Rows[0][0].ToString();
             Session.Add("name", name);
             Session.Add("id", Login.UserName);
             if (Login.UserName.Equals("admin"))
             {
                 Response.Redirect("~/Pages/AdminProfile.aspx?user=" + Login.UserName);
             }
             Response.Redirect("~/Pages/Profile.aspx?user=" + Login.UserName);
         }
     }
     dr.Close();
     con.Close();
 }
開發者ID:jroratorio,項目名稱:easy_kart,代碼行數:25,代碼來源:Default.aspx.cs

示例12: Login_RS_Authenticate

        protected void Login_RS_Authenticate(object sender, AuthenticateEventArgs e)
        {
            try
            {
                sql_cn.Open();//開啟連接

                s_sql_query = "SELECT * FROM Member WHERE Member.UserName = @Member_UserName AND Member.Password = @Member_Password";//用來找出登入者是否存在DB的SQL Query
                sql_cmd = new SqlCommand(s_sql_query, sql_cn);//執行SQL Query的物件
                sql_cmd.Parameters.AddWithValue("@Member_UserName", Login_RS.UserName);
                sql_cmd.Parameters.AddWithValue("@Member_Password", Login_RS.Password);
                sql_dr = sql_cmd.ExecuteReader();//讀取SQL Query執行結果的物件
                e.Authenticated = sql_dr.HasRows;//如果讀到的Row >= 1 身份驗證為true
                if (e.Authenticated)//身份驗證成功時 儲存使用者MID
                {
                    sql_dr.Read();//讀取一列資料
                    Session["MID"] = sql_dr["MID"];//將讀取到的MID存到 Session
                    //Server.Transfer("Home.aspx");
                    //Response.Redirect("Home.aspx");

                    Response.Redirect("GridViewTest.aspx");
                    //Response.Redirect("Rent.aspx");
                }

                sql_cn.Close();//關閉連結
            }
            catch(Exception excp)
            {
               Login_RS.FailureText = excp.ToString();
            }
        }
開發者ID:EastL,項目名稱:my-web,代碼行數:30,代碼來源:Login.aspx.cs

示例13: OnAuthenticate

        protected void OnAuthenticate(object sender, AuthenticateEventArgs e)
        {
            var authenticated = false;
            if (this.LoginUser.UserName == "asd" && this.LoginUser.Password == "168") authenticated = true;

            e.Authenticated = authenticated;
        }
開發者ID:JuRogn,項目名稱:OA,代碼行數:7,代碼來源:Login.aspx.cs

示例14: Login1_Authenticate

        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            string password = Hash(Login1.Password);
              using (DataClasses1DataContext db = new DataClasses1DataContext())
              {
            var department = from a in db.Peoples
                         where (a.UserName == Login1.UserName) && (a.PasswordHash == password)
                         select a;

            foreach( var n in department)
            {
              if (n.DepartmentID == 2)
              {
            Session["User"] = -1;
            Response.Redirect("QABugs.aspx");
              }
              else if (n.DepartmentID == 1)
              {
            Session["User"] = n.PersonID;
            Response.Redirect("DevBugs.aspx");
              }
              else if (n.DepartmentID == 3)
              {
            Session["User"] = n.PersonID;
            Response.Redirect("BugsGalore.aspx");
              }
            }

              }
        }
開發者ID:erodrig9,項目名稱:Bug-Tracking-Software,代碼行數:30,代碼來源:Login.aspx.cs

示例15: ControlLogin_Authenticate

        protected void ControlLogin_Authenticate(object sender, AuthenticateEventArgs e)
        {
            //revisa contra active directory
            Login_ADWS.AutenticacionUsuariosMAGSoapClient autentificacionWS = new Login_ADWS.AutenticacionUsuariosMAGSoapClient();
            try
            {

                var resultado = autentificacionWS.verificarUsuarioSenasa(ControlLogin.UserName, ControlLogin.UserName, ControlLogin.Password);

                using (ServicioGeneral elServicio = new ServicioGeneral())

                if (!elServicio.ValidarUsuario(ControlLogin.UserName))
                {
                    ControlLogin.FailureText = "El usuario no tiene Privilegios";
                    return;
                }
                else
                {
                    Session["usuarioCVOuser"]= ControlLogin.UserName;
                    Session["usuarioCVOnombre"] = resultado;
                    Response.Redirect("Consulta.aspx");
                }
            }
            catch (Exception ex)
            {
                ControlLogin.FailureText = "Error de Usuario/Contraseña";
                return;
            }
        }
開發者ID:langulo,項目名稱:Consulta_CVO,代碼行數:29,代碼來源:Login.aspx.cs


注:本文中的System.Web.UI.WebControls.AuthenticateEventArgs類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。