protected void Login_LoginError(object sender, EventArgs e) { var login = sender as Login; var userNameControl = this.FindControlRecursive("UserName"); var userNameTextBox = userNameControl as TextBox; string userName = null; if (userNameTextBox != null) { userName = userNameTextBox.Text; if (!userName.Contains("\\")) { //add default domain for logging reasons var domain = (String.IsNullOrEmpty(this.DefaultDomain) ? System.Web.Configuration.WebConfigurationManager.AppSettings["DefaultDomain"] : this.DefaultDomain) ?? string.Empty; userName = string.Concat(domain, "\\", userName); } Logger.WriteAudit(AuditEvent.LoginUnsuccessful, new Dictionary <string, object> { { "UserName", userName }, { "ClientAddress", Request.ServerVariables["REMOTE_ADDR"] } }); } var info = new LoginInfo { UserName = userName, Message = login.FailureText }; LoginExtender.OnLoginError(info); _message = info.Message; }
protected void Login_LoginError(object sender, EventArgs e) { var login = sender as Login; var userNameControl = this.FindControlRecursive("UserName"); var userNameTextBox = userNameControl as TextBox; string userName = null; if (userNameTextBox != null) { userName = userNameTextBox.Text; if (!userName.Contains("\\")) { // add default domain for logging reasons var domain = (string.IsNullOrEmpty(this.DefaultDomain) ? IdentityManagement.DefaultDomain : this.DefaultDomain) ?? string.Empty; userName = string.Concat(domain, "\\", userName); } SnLog.WriteAudit(AuditEvent.LoginUnsuccessful, new Dictionary <string, object> { { "UserName", userName }, { "ClientAddress", RepositoryTools.GetClientIpAddress() } }); } var info = new LoginInfo { UserName = userName, Message = login.FailureText }; LoginExtender.OnLoginError(info); _message = info.Message; }