本文整理汇总了C#中System.Web.UI.WebControls.LoginCancelEventArgs类的典型用法代码示例。如果您正苦于以下问题:C# LoginCancelEventArgs类的具体用法?C# LoginCancelEventArgs怎么用?C# LoginCancelEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LoginCancelEventArgs类属于System.Web.UI.WebControls命名空间,在下文中一共展示了LoginCancelEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: cuwRegister_CreatingUser
protected void cuwRegister_CreatingUser(object sender, LoginCancelEventArgs e)
{
if (cuwRegister.UserName !="") {
DropDownList role = (DropDownList)cuwRegister.CreateUserStep.ContentTemplateContainer.FindControl("ddlRoles");
Roles.AddUserToRole(cuwRegister.UserName, role.SelectedItem.Text);
}
}
示例2: LoggingOut
protected void LoggingOut(object sender, LoginCancelEventArgs e)
{
Response.Cookies.Clear();
FormsAuthentication.SignOut();
this.Session["Redirection"] = 0;
Response.Redirect("~/Pages/Index.aspx");
}
示例3: LoginControl_loggingIn
protected void LoginControl_loggingIn(object sender, LoginCancelEventArgs e)
{
var login = sender as Login;
if (login != null && login.UserName.IndexOf("\\") == -1)
{
var domain = (String.IsNullOrEmpty(this.DefaultDomain) ?
System.Web.Configuration.WebConfigurationManager.AppSettings["DefaultDomain"] :
this.DefaultDomain) ??
string.Empty;
login.UserName = string.Concat(domain, "\\", login.UserName);
}
if (OnUserLoggingIn != null)
OnUserLoggingIn(sender, e);
if (login != null)
{
var info = new CancellableLoginInfo { UserName = login.UserName };
LoginExtender.OnLoggingIn(info);
e.Cancel = info.Cancel;
login.UserName = info.UserName;
_message = info.Message;
}
}
示例4: OnRegister
protected void OnRegister(object sender, LoginCancelEventArgs e)
{
if (this.IsValid)
{
try
{
Account account = new Account(tbxEmail.Text, tbxName.Text, AccountType.User);
if(accountManagement.CreateAccount(account, tbxPassword.Text))
{
Response.Redirect("/Login.aspx");
}
else
{
FailureText.Text = "Email is al bezet.";
e.Cancel = true;
}
}
catch
{
FailureText.Text = "Account kon niet worden aan gemaakt.";
e.Cancel = true;
}
}
}
示例5: RegisterUser_CreatingUser
protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
{
/*
string trimmedUserName = RegisterUser.UserName.Trim();
if (RegisterUser.UserName.Length != trimmedUserName.Length)
{
// Show the error message
InvalidUserNameOrPasswordMessage.Text = "The username cannot contain leading or trailing spaces.";
InvalidUserNameOrPasswordMessage.Visible = true;
// Cancel the create user workflow
e.Cancel = true;
}
else
{
// Username is valid, make sure that the password does not contain the username
if (RegisterUser.Password.IndexOf(RegisterUser.UserName, StringComparison.OrdinalIgnoreCase) >= 0)
{
// Show the error message
InvalidUserNameOrPasswordMessage.Text = "The username may not appear anywhere in the password.";
InvalidUserNameOrPasswordMessage.Visible = true;
// Cancel the create user workflow
e.Cancel = true;
}
}
*/
}
示例6: OnLoggingOut
protected void OnLoggingOut(object sender, LoginCancelEventArgs e)
{
string connectionString = ConfigurationManager.ConnectionStrings["BlogEntities"].ConnectionString;
IUserRepository userRepository = new EFUserRepository(connectionString);
ISecurityManager securityManager = new FormsSecurityManager(userRepository);
securityManager.Logout();
}
示例7: lgnGeneral_LoggingIn
protected void lgnGeneral_LoggingIn(object sender, LoginCancelEventArgs e)
{
if (Request.ServerVariables["REMOTE_USER"] != null)
{
Session["UserId"] = Util.ReturnUserId(Request.ServerVariables["REMOTE_USER"]);
}
}
示例8: LoginStatus1_LoggingOut
protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)
{
Session["AccCls"] = null;
Session.Abandon();
Session.RemoveAll();
Response.Redirect("~/pages/Login.aspx");
}
示例9: loginTemplate_LoggingIn
protected void loginTemplate_LoggingIn(object sender, LoginCancelEventArgs e) {
if (FormsAuthentication.Authenticate(loginTemplate.UserName, loginTemplate.Password)) {
FormsAuthentication.RedirectFromLoginPage(loginTemplate.UserName, false);
} else {
divMsg.Visible = true;
}
}
示例10: RegisterUser_CreatingUser
/// <summary>
/// Handles the CreatingUser event of the RegisterUser control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.Web.UI.WebControls.LoginCancelEventArgs"/> instance containing the event data.</param>
protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
{
App_Code.Controls.RecaptchaControl captcha =
(App_Code.Controls.RecaptchaControl)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("recaptcha") as App_Code.Controls.RecaptchaControl;
if (Membership.GetUser(this.RegisterUser.UserName) != null)
{
e.Cancel = true;
this.Master.SetStatus("warning", Resources.labels.anotherUserName);
}
else if (Membership.GetUserNameByEmail(this.RegisterUser.Email) != null)
{
e.Cancel = true;
this.Master.SetStatus("warning", Resources.labels.anotherEmail);
}
else if (captcha != null)
{
captcha.Validate();
if (!captcha.IsValid)
{
e.Cancel = true;
this.Master.SetStatus("warning", "Captcha invalid.");
}
}
}
示例11: RegisterUser_CreatingUser
/// <summary>
/// Create new user.
/// </summary>
/// <param name="sender">The object that raised this event.</param>
/// <param name="e">An EventArgs that contains the event data.</param>
protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
{
//Set status text to show nothing
status_msg.Text = "";
//Check if email is in correct form
if (!Regex.IsMatch(RegisterUser.Email,
@"^(?("")(""[^""]+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))" +
@"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$"))
{
//Alert user what the error is
status_msg.Text = "The email is invalid.";
// Cancel the create user workflow
e.Cancel = true;
}
//Check if user with the entered email already exists
else if (Membership.GetUserNameByEmail(RegisterUser.Email) == RegisterUser.Email)
{
//Alert user what the error is
duplicateUserMsg.Text = "A user with this email already exists. Please try again with a different email.";
// Cancel the create user workflow
e.Cancel = true;
}
else
{
//If everything is good, set email to be the creating username
RegisterUser.UserName = RegisterUser.Email;
}
}
示例12: LoginStatus1_LoggingOut
protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)
{
}
示例13: prRecoverPassword_VerifyingUser1
protected void prRecoverPassword_VerifyingUser1(object sender, LoginCancelEventArgs e)
{
if (prRecoverPassword.UserName.Contains("@"))
{
string username = Membership.GetUserNameByEmail(prRecoverPassword.UserName);
if (!string.IsNullOrEmpty(username))
prRecoverPassword.UserName = username;
}
}
示例14: CreateUserWizard1_CreatingUser
protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
{
(Membership.Provider as CustomMembershipProvider).FirstName = (CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtFirstName") as TextBox).Text;
(Membership.Provider as CustomMembershipProvider).LastName = (CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtLastName") as TextBox).Text;
(Membership.Provider as CustomMembershipProvider).Address = string.Empty;
(Membership.Provider as CustomMembershipProvider).City = string.Empty;
(Membership.Provider as CustomMembershipProvider).Phone = string.Empty;
(Membership.Provider as CustomMembershipProvider).UserType = (CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("cmbUserType") as DropDownList).SelectedItem.Text;
}
示例15: CreatingUser
/// <summary>
/// Handles the CreateUser event of the CreateUserWizard1 control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
protected void CreatingUser(object sender, LoginCancelEventArgs e)
{
HIPControl captcha = (HIPControl)CreateUserWizardStep1.ContentTemplateContainer.FindControl("CapchaTest");
if (!captcha.IsValid || !Page.IsValid)
{
e.Cancel = true;
}
}