示例#1
0
 public virtual void lnkPermaLink_Click(object sender, EventArgs e)
 {
     if (viewModel != null && viewModel.List != null && viewModel.List.CriteriaObject != null)
     {
         Response.Redirect(WebUtil.AddQueryString(Request.RawUrl, viewModel.List.CriteriaObject.ToNameValueCollection()));
     }
 }
示例#2
0
        public void Process(DeferredRegistrationArgs args)
        {
            Assert.ArgumentNotNull(args, "args");
            Assert.ArgumentNotNullOrEmpty(args.EncryptedToken, "args.EncryptedToken");
            Assert.ArgumentNotNullOrEmpty(args.UserData.FirstName, "args.UserData.FirstName");
            Assert.ArgumentNotNullOrEmpty(args.UserData.LastName, "args.UserData.LastName");
            Assert.ArgumentNotNull(args.MailMessage, "args.MailMessage");
            Assert.ArgumentNotNullOrEmpty(args.MailMessage.Body, "args.MailMessage.Body");

            var processActivationLinkPageId = Settings.GetSetting("DeferredRegistration.PageToProcessActivationLink");

            Assert.ArgumentNotNullOrEmpty(processActivationLinkPageId, "processActivationLinkPageId");

            var processActivationLinkPageItem = Sitecore.Context.Database.GetItem(processActivationLinkPageId);

            Assert.ArgumentNotNull(processActivationLinkPageItem, "processActivationLinkPageItem");

            var urlOptions = new UrlOptions
            {
                AlwaysIncludeServerUrl = true,
                LanguageEmbedding      = LanguageEmbedding.Never
            };
            var deferredRegistrationPageUrl = LinkManager.GetItemUrl(processActivationLinkPageItem, urlOptions);

            var activationLink = WebUtil.AddQueryString(deferredRegistrationPageUrl, "hash", args.EncryptedToken);

            args.MailMessage.Body = args.MailMessage.Body.Replace("{activation-link}", activationLink);
            args.MailMessage.Body = args.MailMessage.Body.Replace("{name}", args.UserData.FirstName);
        }
 public virtual void PermaLink_Click(object sender, EventArgs e)
 {
     if (VM?.List?.CriteriaObject == null)
     {
         return;
     }
     Response.Redirect(WebUtil.AddQueryString(Request.RawUrl, VM.List.CriteriaObject.ToNameValueCollection()));
 }
示例#4
0
        public override string GetMediaUrl(MediaItem item, Sitecore.Links.UrlBuilders.MediaUrlBuilderOptions options)
        {
            var url = base.GetMediaUrl(item, options);

            if (item.MimeType.StartsWith("image") && HttpContext.Current.BrowserSupportsWebP())
            {
                url = WebUtil.AddQueryString(url, "extension", "webp");
            }

            return(url);
        }
示例#5
0
        public override string GetMediaUrl(MediaItem item, MediaUrlOptions options)
        {
            var url = base.GetMediaUrl(item, options);

            if (item.MimeType.StartsWith("image") && HttpContext.Current.BrowserSupportsWebP() && !url.Contains("extension"))
            {
                url = WebUtil.AddQueryString(url, "extension", "webp");
            }

            return(url);
        }
        public override void Process(RequestBeginArgs args)
        {
            if (Settings.Authentication.SaveRawUrl &&
                Sitecore.Context.User.Name == "sitecore\\Anonymous")

            {
                string      somet     = args.PageContext.RequestContext.HttpContext.Items["SC_REQUEST_MEASUREMENT_URL"].ToString();
                SiteContext site      = Context.Site;
                string      loginPage = this.GetLoginPage(site);
                string      url       = WebUtil.AddQueryString(loginPage + "?returnurl=" + HttpUtility.UrlEncode(somet));
                System.Web.HttpContext.Current.Response.Redirect(url);
            }
        }
示例#7
0
        private string GetNotFoundUrl()
        {
            var notFoundItem = _errorItemResolver.GetNotFoundItem();

            if (notFoundItem == null)
            {
                return(null);
            }

            var baseUrl     = GetItemUrl(notFoundItem);
            var queryString = GetStatusCodeQueryString();

            return(WebUtil.AddQueryString(baseUrl, queryString));
        }
        protected virtual ActionResult RedirectToNotFound()
        {
            PageContext current   = PageContext.Current;
            string      localPath = current.RequestContext.HttpContext.Request.Url.LocalPath;
            string      str       = ObjectExtensions.ValueOrDefault <Route, string>(current.RequestContext.RouteData.Route as Route, (Func <Route, string>)(route => route.Url));

            if (str != null)
            {
                localPath += Sitecore.StringExtensions.StringExtensions.FormatWith(" (route: {0})", (object)str);
            }
            string userName = Context.GetUserName();
            string siteName = Context.GetSiteName();

            return((ActionResult)this.Redirect(WebUtil.AddQueryString(Settings.ItemNotFoundUrl, "item", localPath, "user", userName, "site", siteName)));
        }
示例#9
0
        protected virtual ActionResult RedirectToNotFound()
        {
            PageContext current   = PageContext.Current;
            string      localPath = current.RequestContext.HttpContext.Request.Url.LocalPath;
            string      str2      = (current.RequestContext.RouteData.Route as Route).ValueOrDefault <Route, string>(route => route.Url);

            if (str2 != null)
            {
                localPath = localPath + " (route: {0})".FormatWith(new object[] { str2 });
            }
            string userName = Context.GetUserName();
            string siteName = Context.GetSiteName();
            string url      = WebUtil.AddQueryString(Settings.ItemNotFoundUrl, new string[] { "item", localPath, "user", userName, "site", siteName });

            return(this.Redirect(url));
        }
示例#10
0
        public string ResolveRedirectUrl()
        {
            var current = PageContext.Current;
            var str1    = current.RequestContext.HttpContext.Request.Url.LocalPath;
            var str2    = (current.RequestContext.RouteData.Route as Route).ValueOrDefault((Func <Route, string>)(route => route.Url));

            if (str2 != null)
            {
                str1 = str1 + Sitecore.StringExtensions.StringExtensions.FormatWith(" (route: {0})", new object[1] {
                    (object)str2
                });
            }
            var userName = Context.GetUserName();
            var siteName = Context.GetSiteName();

            return(WebUtil.AddQueryString(Settings.ItemNotFoundUrl, "item", str1, "user", userName, "site", siteName));
        }
示例#11
0
 public virtual void lnkPermaLink_Click(object sender, EventArgs e)
 {
     Response.Redirect(WebUtil.AddQueryString(Request.RawUrl, criteria.ToNameValueCollection()));
 }