当前位置: 首页>>代码示例>>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;未经允许,请勿转载。