public ActionResult Index() { //logger.Log(null, "DifficultyFactorLabour conversion", "test message", Verbosity.Trace); //Check for the existence of the auth cookie (on SSO) for the received domain. var tmpLoginModel = new ScrAccount(); string languageCode = "nl-BE"; tmpLoginModel.SetLanguage(languageCode); if (Request.QueryString.Count >= 2) { tmpLoginModel.ResponseDomain = Request.QueryString["domain"]; tmpLoginModel.ResponseRelativePath = Request.QueryString["ReturnUrl"]; HttpCookie currDomainCookie = HttpContext.Request.Cookies.Get(tmpLoginModel.ResponseDomain); if (currDomainCookie != null) { string userName = currDomainCookie["userName"]; try { //The cookie already exists. //1. Refresh the cookies for all domains for which the user has the access rights. CreateOrRefreshAllCookies(tmpLoginModel.ResponseDomain, userName); }catch (Exception ex) { //logger.Log(null, "Index error on CreateOrRefreshAllCookies", "User:"******" Request for domain: " + tmpLoginModel.ResponseDomain + "Error message:" + ex.Message, Verbosity.Trace); } //2. Navigate to the source domain create cookie handler. //Redirect string url = string.Format("{0}://{1}/{2}?user={3}&returnUrl={4}", Protocol.ToString(), tmpLoginModel.ResponseDomain, "auth.login", System.Net.WebUtility.UrlEncode(userName), tmpLoginModel.ResponseRelativePath); //logger.Log(null, "Already logged in. Navigate to the authentication handler of the domain.", "User:"******" Request for domain: " + tmpLoginModel.ResponseDomain, Verbosity.Trace); Response.Redirect(url); } } if (Request.QueryString.Count >= 3) { string err = Request.QueryString["err"]; if (err != null) { tmpLoginModel.IsValid = false; ModelState.AddModelError("Password change failed!", err); } } //The SSO cookie doesn't exist. //1. Login page SSO. string viewName = (tmpLoginModel.ResponseDomain == null ? "Index" : GetLoginViewName(tmpLoginModel.ResponseDomain)); return(View(viewName, tmpLoginModel)); }