本文整理汇总了C#中AuthenticateEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# AuthenticateEventArgs类的具体用法?C# AuthenticateEventArgs怎么用?C# AuthenticateEventArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AuthenticateEventArgs类属于命名空间,在下文中一共展示了AuthenticateEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Login1_Authenticate
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
string strCon = ConfigurationManager.ConnectionStrings["LoginConnectionString"].ConnectionString;
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["LoginConnectionString"].ConnectionString);
//using (SqlConnection con = new SqlConnection(strCon))
{
using (SqlCommand cmdStr = new SqlCommand("SELECT TOP(1) * FROM [Department] WHERE DepartmentID = '" + Login1.UserName +
"' AND DepartmentPassword = '" + Login1.Password + "'", con))
{
try
{
con.Open();
if (cmdStr.ExecuteReader().HasRows)
{
e.Authenticated = true;
Session["login_name"] = Login1.UserName.ToString();
Session.Timeout = 40;
return;
}
else
{
Session.Abandon();
}
}
finally
{
con.Close();
}
}
}
}
示例2: Login1_Authenticate
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
WorkerService ws = new WorkerService();
Session["WorkerFirstName"] = ws.ValidateWorker(this.Login1.UserName, this.Login1.Password);
if (Session["WorkerFirstName"] != null)
e.Authenticated = true;
}
示例3: Login_Authenticate
protected void Login_Authenticate(object sender, AuthenticateEventArgs e)
{
if (Membership.ValidateUser(Login.UserName, Login.Password))
{
FormsAuthentication.RedirectFromLoginPage(Login.UserName, false);
}
}
示例4: loginWindow_Authenticate
protected void loginWindow_Authenticate(object sender, AuthenticateEventArgs e)
{
if (PasswordHelper.authenticateUser(loginWindow.UserName.ToString(), loginWindow.Password.ToString()))
e.Authenticated = true;
else
e.Authenticated = false;
}
示例5: LoginUser_Authenticate
protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
{
SqlConnection con = new SqlConnection();
//string hh = "select *from tbuser where uname='" + Login1.UserName + "' and upass='" + Encrypt(Login1.Password, true).ToString() + "'";
con.ConnectionString = ConfigurationManager.ConnectionStrings["forest_depoConnectionString"].ConnectionString;
con.Open();
SqlCommand cmd = new SqlCommand();
cmd.CommandText = "user_log";
cmd.CommandType = CommandType.StoredProcedure;
cmd.Connection = con;
cmd.Parameters.Add("@un", SqlDbType.VarChar, 50).Value = LoginUser.UserName.ToString();
cmd.Parameters.Add("@up", SqlDbType.VarChar, 50).Value = LoginUser.Password.ToString();
SqlDataReader dr = cmd.ExecuteReader();
dr.Read();
if (dr.HasRows)
{
FormsAuthenticationTicket tkt = new FormsAuthenticationTicket(1, LoginUser.UserName, DateTime.Now, DateTime.Now.AddHours(2), false, dr[3].ToString(), FormsAuthentication.FormsCookiePath);
string st1;
st1 = FormsAuthentication.Encrypt(tkt);
HttpCookie ck = new HttpCookie(FormsAuthentication.FormsCookieName, st1);
Response.Cookies.Add(ck);
string role = dr[3].ToString();
//if (dr[3].ToString() == "admin".ToString())
//{
// //Response.Redirect("focus1/admin/");
Session["start_a"] = "start";
if (dr["role"].ToString() == "admin")
{
Response.Redirect("../admin/speces_size_type.aspx");
}
if (dr["role"].ToString() == "admin2")
{
Response.Redirect("../admin2/auc_cal.aspx");
}
if (dr["role"].ToString() == "admin3")
{
Response.Redirect("../admin3/gate_pass.aspx");
}
if (dr["role"].ToString() == "admin4")
{
Response.Redirect("../admin4/");
}
}
// else
// {
// Session["start_u"] = "start";
// // Response.Redirect("focus1/user/");
// Response.Redirect("user/");
// }
//}
else
{
LoginUser.FailureText = "Wrong UserName or Password";
//Response.Redirect("error.aspx");
}
}
示例6: AuthenticateAsync
public Task<bool> AuthenticateAsync()
{
if (this.AuthenticationRequested == null)
{
throw new NotSupportedException("Must provide a AuthenticationRequested event handler.");
}
var args = new AuthenticateEventArgs();
this.AuthenticationRequested(this, args);
if (!args.IsSuccessful.HasValue)
{
throw new NotSupportedException("Must specify Success/Failure in event handler");
}
this.IsAuthenticated = args.IsSuccessful.Value;
this.CurrentUserId = args.Id;
if (this.IsAuthenticatedChanged != null)
{
this.IsAuthenticatedChanged(this, EventArgs.Empty);
}
return Task.FromResult(this.IsAuthenticated);
}
示例7: Login1_Authenticate
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
String sqlCommand = "SELECT NIF FROM Clientes WHERE NIF=\"" + Login1.UserName + "\"";
// como nao temos passwords na bd, apenas interessa o nif
SqlCommand sql = new SqlCommand();
sql.CommandType = CommandType.Text;
sql.Connection = editoraConnection;
sql.CommandText = sqlCommand;
editoraConnection.Open();
int val = sql.ExecuteNonQuery();
editoraConnection.Close();
if(val == 1)
{
// sucesso
}
else
{
// falha
um.logInUser(Login1.UserName);
Response.Redirect("Default.aspx");
}
}
示例8: Login_Authenticate
protected void Login_Authenticate(object sender, AuthenticateEventArgs e)
{
String loginUsername = aspLogin.UserName;
String loginPassword = aspLogin.Password;
if (Membership.ValidateUser(loginUsername, loginPassword))
{
e.Authenticated = true;
Response.Redirect("splash.aspx", false);
}
else
{
bool successfulUnlock = AutoUnlockUser(loginUsername);
if (successfulUnlock)
{
//re-attempt the login
if (Membership.ValidateUser(loginUsername, loginPassword))
{
e.Authenticated = true;
Response.Redirect("splash.aspx", true);
}
else
{
e.Authenticated = false;
// Error message to display same message if user exsits and password incorrect for security reasons.
Info.Text = ErrorMessage + "Your username and/or password are invalid." + " <a href='forgottenpassword.aspx'>Click here</a> if you have forgotten your details.</div></div>";
}
}
e.Authenticated = false;
Info.Text = ErrorMessage + "Your username and/or password are invalid." + " <a href='forgottenpassword.aspx'>Click here</a> if you have forgotten your details.</div></div>";
Info.Visible = true;
// NovaLogin.FailureText = "Your username and/or password are invalid.";
}
}
示例9: Login1_Authenticate
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
try
{
if (BiFactory.CheckLogin(Login1.UserName, Login1.Password))
{
FormsAuthentication.SetAuthCookie(BiFactory.User.Nombre, true);
Logger.Log(TipoEvento.Login,"Inició Session");
//Response.Redirect("../default.aspx");
Response.Redirect("~/solicitudes/Solicitudes.aspx");
}
else
{
Session["user"] = null;
// Logger.Log(TipoEvento.Login, Login1.UserName.ToString() + " Intento Conectarse al Sistema");
}
}
catch (Exception ex)
{
lblMensaje.Text = ("Error" + ex.Message.ToString());
Login1.InstructionText = "Usuario invalido";
}
}
示例10: Login1_Authenticate
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
if (Login1.UserName == "ferroli" && Login1.Password == "901")
{
FormsAuthentication.RedirectFromLoginPage(Login1.UserName, Login1.RememberMeSet);
}
}
示例11: Login1_Authenticate
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
DirectoryEntry entry = new DirectoryEntry("LDAP://NTNIGE", Login1.UserName, Login1.Password);
try
{
object ent = entry.NativeObject;
e.Authenticated = true;
SqlConnection con = new SqlConnection();
SqlCommand cmd = new SqlCommand();
con.ConnectionString = ConfigurationManager.ConnectionStrings["nfte"].ConnectionString;
cmd.Connection = con;
cmd.CommandText = string.Format("select count(*) from nfte.users where userid = '{0}'", Login1.UserName.Trim());
con.Open();
object o = cmd.ExecuteScalar();
int usercount = Convert.ToInt32(o);
if (usercount > 0)
{
FormsAuthentication.SetAuthCookie(Login1.UserName, false);
}
else
{
e.Authenticated = false;
Login1.FailureText = "Your username or password is wrong,please check it and try again";
}
}
catch
{
e.Authenticated = false;
Login1.FailureText = "Internal error while trying to log in";
}
}
示例12: Login1_Authenticate
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
string GetUserDetail = string.Format("select * from tb_user where username = '{0}' and [password] = '{1}' and status = '1'", Login1.UserName, Login1.Password );
DataSet ds = dbTool.ExecuteDataSet(GetUserDetail);
DataTable dt = ds.Tables[0];
if (dt.Rows.Count != 1)
{
Login1.FailureAction = LoginFailureAction.RedirectToLoginPage;
}
else
{
string position = Convert.ToString(dt.Rows[0]["position"]);
Session["userid"] = Convert.ToString(dt.Rows[0]["userid"]);
Session["firstname"] = Convert.ToString(dt.Rows[0]["firstname"]);
Session["lastname"] = Convert.ToString(dt.Rows[0]["lastname"]);
if (position == "admin")
{
Response.Redirect("Admin/E-Library/addNewBook.aspx");
}
else if (position == "user")
{
//Response.Redirect("User/SearchByCategory.aspx");
Response.Redirect("User/UserPanel.aspx");
}
}
}
示例13: Login1_Authenticate
protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
{
if ((((Login)sender).UserName == "Munuslito") && (((Login)sender).Password == "robinwalt98"))
{
e.Authenticated = true;
}
}
示例14: LoginAuthenticate
protected void LoginAuthenticate(object sender, AuthenticateEventArgs e)
{
TextBox uname = (TextBox)login.FindControl("UserName");
TextBox pword = (TextBox)login.FindControl("Password");
e.Authenticated = Membership.ValidateUser(uname.Text, pword.Text);
}
示例15: LoginUser_Authenticate
protected void LoginUser_Authenticate(object sender, AuthenticateEventArgs e)
{
using (SqlConnection cn =
new SqlConnection(ConfigurationManager.ConnectionStrings["WoWiConnectionString"].ConnectionString))
{
cn.Open();
SqlCommand cmd =
new SqlCommand("Select username from employee Where [email protected] and [email protected] and status='Active'", cn);
cmd.Parameters.AddWithValue("@username", LoginUser.UserName);
cmd.Parameters.AddWithValue("@password", LoginUser.Password);
SqlDataReader dr = cmd.ExecuteReader();
if (dr.HasRows)
{
while (dr.Read())
{
string username = dr["username"].ToString();
using (WoWiModel.WoWiEntities wowidb = new WoWiModel.WoWiEntities())
{
int id = (from emp in wowidb.employees where emp.username == username select emp.id).First();
Session["Session_User_Id"] = id;
}
FormsAuthentication.RedirectFromLoginPage(username , LoginUser.RememberMeSet);
}
}
}
}