Beispiel #1
0
        public virtual void Process(RequestBeginArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Profiler.StartOperation("Check security access to page.");

            if (!HasAccess())
            {
                args.AbortPipeline();
                var loginPage = GetLoginPage(Context.Site);
                if (loginPage.Length > 0)
                {
                    var urlString = new UrlString(loginPage);
                    if (Settings.Authentication.SaveRawUrl)
                    {
                        urlString.Append("url", HttpUtility.UrlEncode(Context.RawUrl));
                    }

                    var absolutePath = HttpContext.Current.Request.Url.AbsolutePath;
                    if (!string.IsNullOrEmpty(absolutePath))
                    {
                        urlString["returnUrl"] = absolutePath;
                    }

                    Tracer.Info("Redirecting to login page \"" + loginPage + "\".");

                    WebUtil.Redirect(urlString.ToString(), false);
                }
                else
                {
                    Tracer.Info("Redirecting to error page as no login page was found.");
                    WebUtil.RedirectToErrorPage("Login is required, but no valid login page has been specified for the site (" + Context.Site.Name + ").", false);
                }
            }

            Profiler.EndOperation();
        }
        public override void Process(RequestBeginArgs args)
        {
            RequestContext requestContext = args.PageContext.RequestContext;

            if (requestContext == null || !RouteMapper.IsLayoutServiceRoute(requestContext))
            {
                return;
            }

            var queryString = args.PageContext.RequestContext.HttpContext.Request.QueryString;
            var email       = queryString["email"];

            if (!string.IsNullOrWhiteSpace(email))
            {
                try
                {
                    Tracker.Current?.Session?.IdentifyAs(Wellknown.EMAIL_IDENT_SOURCE, email);
                }
                catch (Exception ex)
                {
                    Log.Error("Unable to set contact identifier", ex, this);
                }
            }
        }
Beispiel #3
0
        /// <summary>
        /// Executes the handler.
        /// </summary>
        /// <param name="controllerName">Name of the controller.</param>
        /// <param name="actionName">Name of the action.</param>
        /// <param name="areaName">Name of the area.</param>
        /// <param name="namespaceName">Name of the namespace.</param>
        /// <param name="args">The arguments.</param>
        protected virtual void ExecuteHandler(string controllerName, string actionName, string areaName, string namespaceName, RequestBeginArgs args)
        {
            string str = (new AreaControllerRunner(controllerName, actionName, areaName, namespaceName)).Execute();

            if (str.IsEmptyOrNull())
            {
                return;
            }

            RequestContext requestContext = PageContext.Current.RequestContext;

            requestContext.HttpContext.Response.Output.Write(str);
            requestContext.RouteData.Values["scOutputGenerated"] = "1";
        }
Beispiel #4
0
        /// <summary>
        /// Executes the handler.
        /// </summary>
        /// <param name="formValues">The form values.</param>
        /// <param name="args">The arguments.</param>
        protected override void ExecuteHandler(System.Collections.Specialized.NameValueCollection formValues, RequestBeginArgs args)
        {
            string str           = formValues["scController"].OrIfEmpty(MvcSettings.DefaultFormControllerName);
            string item          = formValues["scAction"];
            string areaName      = formValues["scArea"];
            string namespaceName = formValues["scNamespace"];
            Tuple <string, string> controllerAndAction = MvcSettings.ControllerLocator.GetControllerAndAction(str, item);

            if (controllerAndAction == null)
            {
                return;
            }

            ExecuteHandler(controllerAndAction.Item1, controllerAndAction.Item2, areaName, namespaceName, args);
        }
 public override void Process(RequestBeginArgs args)
 {
     HttpContext.Current.Items[TVPHelper.HttpContextKey] = new TVPHelper();
 }