Ejemplo n.º 1
0
        void OnUnauthorizedAccess(IUnauthorizedPageAccessEvent unauthorizedEvent)
        {
            var url = unauthorizedEvent.Page.Url.TrimStart('~');

            //for this specific page redirect to CustomerLoginPage
            //if (unauthorizedEvent.Page.Title.Contains("user-dashboard"))
            unauthorizedEvent.HttpContext.Response.Redirect("~/sign-in");
            //for all other pages redirect to the Sitefinity login page
            //if you do not use the else clause you will be redirected to the Sitefinity login page in all other cases different that the above one
            //else
            //    unauthorizedEvent.HttpContext.Response.Redirect("~/sitefinity");
        }
Ejemplo n.º 2
0
        private void OnUnauthorizedAccess(IUnauthorizedPageAccessEvent unauthorizedEvent)
        {
            // RWB 20171003 - var url = unauthorizedEvent.Page.Url.TrimStart('~');
            HttpRequest req = HttpContext.Current.Request;
            var         url = req.AppRelativeCurrentExecutionFilePath.TrimStart('~');

            var currentContext       = unauthorizedEvent.HttpContext;
            var page                 = unauthorizedEvent.Page;
            var redirectStrategyType = unauthorizedEvent.RedirectStrategy;
            var redirectUrl          = unauthorizedEvent.RedirectUrl;

            log.Debug("Page-auth request with page title of:{0}".Fmt(unauthorizedEvent.Page.Title));
            unauthorizedEvent.HttpContext.Response.Redirect("{0}/?ReturnUrl={1}".Fmt(GetLoginPage, url));
        }