public void ProcessRequest(HttpContext context) { string url = context.Request.QueryString["ReturnUrl"]; if (url == null || url.Length == 0) context.Response.Redirect("~/"); if (context.User.Identity.IsAuthenticated) context.Response.Redirect(url); WebAuthenticator webAuth = new WebAuthenticator(); webAuth.UsesClientFrameset = true; // without this, a parser error is displayed in some browsers context.Response.Write("<html></html>"); if (webAuth.Login(Constants.APPLICATION_NAME)) { try { SouthernIdentity id = new SouthernIdentity(webAuth.SecurityToken); //TODO: OPTIONAL: Add Extra Application Data to Forms Ticket webAuth.UserData.Add("UserName", id.Name); Log.Write("Getting user information for {0}", Log.Mask.Diagnostic, id.Name); LPHSUser user = LPHSUser.GetBySid(id.SID); if (user != null) { if (!user.Active) { //FormsAuthentication.SignOut(); //webAuth.Logout("~/Account/DenyAccess?ReturnUrl=%2f&msg=Access%20Denied.%20This%20account%20is%20inactive.".ToAbsoluteUrl()); DenyAccess(context, "Access Denied. This account is inactive."); } webAuth.UserData.Add("Email", user.EmailAddress); webAuth.UserData.Add("DisplayName", user.DisplayName); webAuth.UserData.Add("ID", user.ID); webAuth.UserData.Add("Active", user.Active); webAuth.UserData.Add("SchoolID", user.SchoolID ?? -1); webAuth.UserData.Add("UserType", user.UserType.ToString()); webAuth.UserData.Add("SumTotalID", user.SumTotalID ?? ""); //webAuth.UserRoles.Add("Teacher"); webAuth.UserRoles.Add(user.UserType.ToString()); user.LastLoggedOn = DateTime.UtcNow; LPHSUser.Update(user); } else DenyAccess(context, "Access Denied. This account is not permitted to access Learning Power."); //Write the Forms Ticket webAuth.WriteTicket(); } catch (Exception ex) { Log.Write(ex, Log.Mask.Failure); DenyAccess(context, "An error ocurred logging into Learning Power."); //throw; //DenyAccess(context); } finally { } } }