protected void Login1_Authenticate(object sender, AuthenticateEventArgs e) { bool authenticated = false; int doctorId; // return IPAddress ClassFunctions newFunc = new ClassFunctions(); string ipAddress = newFunc.GetUserIP(); authenticated = this.SiteLevelCustomAuthenticationMethod(this.Login1.UserName, this.Login1.Password, out doctorId); e.Authenticated = authenticated; if (authenticated == true) { // capture DoctorId this.Session["DoctorId"] = doctorId.ToString(); // insert into logfile this.InsertLogFile(Convert.ToInt32(this.Session["DoctorId"]), ipAddress, "Success", "Login"); // go this.Response.Redirect("DoctorPortal.aspx", true); } else { // insert into logfile this.InsertLogFile(0, ipAddress, "LoginFailed", "Login"); this.Login1.FailureText = "Login Username and Password are invalid !"; } }