/// <summary>
        /// Called before the action method is invoked.
        /// </summary>
        /// <param name="filterContext">Information about the current request and action.</param>
        protected override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (LoggedInUser != null)
            {
            }

            SetCachingPreferences();

            //Read QueryString parameter values
            LoadParameters();

            if (Request.HttpMethod == "POST")
            {
                //If this is a postback, do not redirect to SSO site.
                //Rather, hit a web method to the SSO site to know user's logged in status
                //and proceed based on the status
                HandlePostbackRequest();
                //   base.OnLoad(e);
                return;
            }

            //If the current request is marked not to be redirected to SSO site, do not proceed
            if (SessionAPI.RequestRedirectFlag == false)
            {
                SessionAPI.ClearRedirectFlag();
                //  base.OnLoad(e);
                return;
            }

            if (string.IsNullOrEmpty(RequestId))
            {
                //Absence of Request Paramter RequestId means current request is not redirected from SSO site.
                //So, redirect to SSO site with ReturnUrl
                RedirectToSSOSite();
                return;
            }
            else
            {
                //Current request is redirected from the SSO site. So, check user status
                //And redirect to appropriate page
                ValidateUserStatusAndRedirect();
            }

            //if (LoggedInUser != null)
            //{
            //    ViewBag.FullName = LoggedInUser.FullName;
            //    ViewBag.UserId = LoggedInUser.UserId;
            //    ViewBag.UserName = LoggedInUser.UserName;
            //    ViewBag.Timeout = int.Parse(ConfigurationManager.AppSettings["SessionTimeout"]) * 60000; // Minutes to Milliseconds
            //}

            base.OnActionExecuting(filterContext);
        }
Exemple #2
0
        protected override void OnLoad(EventArgs e)
        {
            //Set caching preferences
            SetCachingPreferences();

            //Read QueryString parameter values
            LoadParameters();

            if (IsPostBack)
            {
                //If this is a postback, do not redirect to SSO site.
                //Rather, hit a web method to the SSO site to know user's logged in status
                //and proceed based on the status
                HandlePostbackRequest();
                base.OnLoad(e);
                return;
            }

            //If the current request is marked not to be redirected to SSO site, do not proceed
            if (SessionAPI.RequestRedirectFlag == false)
            {
                SessionAPI.ClearRedirectFlag();
                base.OnLoad(e);
                return;
            }

            if (string.IsNullOrEmpty(RequestId))
            {
                //Absence of Request Paramter RequestId means current request is not redirected from SSO site.
                //So, redirect to SSO site with ReturnUrl
                RedirectToSSOSite();
                return;
            }
            else
            {
                //Current request is redirected from the SSO site. So, check user status
                //And redirect to appropriate page
                ValidateUserStatusAndRedirect();
            }

            base.OnLoad(e);
        }