public ActionResult LoginLang(Login login) { string returnUrl = /* Request["ReturnUrl"] ??*/ "/en-US/QueryLayoutTree/QueryLayoutTree"; bool isAvr = false; //if (!String.IsNullOrWhiteSpace(Request["ReturnUrl"])) //{ // isAvr = Request["ReturnUrl"].Contains("AVR"); //} if (login.Authorize()) { ObjectStorage.Remove(Session.SessionID); //MenuHelper.ClearMenuCache(); HttpCookie avrCookie = FormsAuthentication.GetAuthCookie(login.UserName, false); //avrCookie.Domain = GetAvrPath(); Response.AppendCookie(avrCookie); if (isAvr) { return(Redirect(String.Format("{0}?lang={1}", returnUrl, login.LanguagePreference))); } else { string adj = returnUrl.Replace("/", ""); if (!Cultures.StringIsCulture(adj)) { returnUrl = returnUrl.Substring(returnUrl.Substring(1).IndexOf("/") + 1); } else { returnUrl = returnUrl.Replace(adj, ""); } return(Redirect(String.Format("/{0}{1}", login.LanguagePreference, returnUrl))); } } SetSelectedLanguage(); return(View(login)); }