public ActionResult Logout(string keyResponseDomainSite, string userName) { ScrLogout model = new ScrLogout(keyResponseDomainSite); //For each domain that user can see we need to add image tag with source that is pointing out to signout handler that will return image after clean up //only exception in domain list is domain that was initialy used to signout. IDBDataAccess db = new DBDataAccess(); UserMappings currentAccount = db.GetUsermappings(keyResponseDomainSite, userName); if (currentAccount != null) { List <UserMappings> domainUserAccounts = db.GetUsermappings(currentAccount.UserAccountID); foreach (UserMappings userMappings in domainUserAccounts) { if (userMappings.DomainName != keyResponseDomainSite) { model.DomainNames.Add(userMappings.DomainName); } } } string[] cookies = this.Request.Cookies.AllKeys; foreach (var cookie in cookies) { this.Request.Cookies[cookie].Expires = DateTime.Now.AddDays(-1); this.Response.Cookies.Add(this.Request.Cookies[cookie]); } return(View(model)); }
/// <summary> /// /// </summary> /// <param name="keyResponseDomainSite">E.g. localhost:63256 or dcatest.claimshub.eu</param> /// <param name="userName">Username for the keyResponseDomainSite</param> private void CreateOrRefreshAllCookies(string keyResponseDomainSite, string userName) { IDBDataAccess db = new DBDataAccess(); UserMappings currentAccount = db.GetUsermappings(keyResponseDomainSite, userName); if (currentAccount != null) { List <UserMappings> domainUserAccounts = db.GetUsermappings(currentAccount.UserAccountID); foreach (UserMappings userMappings in domainUserAccounts) { CreateOrRefreshCookie(userMappings); } } }