Exemple #1
0
        protected ReadOnlyUrl GetSwitchBrowserUrl(bool mobile, ReadOnlyUrl returnUrl)
        {
            var url = _switchBrowserUrl.AsNonReadOnly();

            url.QueryString["mobile"]    = mobile.ToString();
            url.QueryString["returnUrl"] = returnUrl.PathAndQuery;
            return(url);
        }
        public void TestQueryString()
        {
            var url         = new ReadOnlyApplicationUrl(true, "~/unsubscribe.aspx");
            var redirectUrl = new ReadOnlyApplicationUrl(true, "~/accounts/settings/unsubscribe");

            AssertRedirect(url, redirectUrl, redirectUrl);

            // Make sure it redirects with the query string.

            var          userId   = Guid.NewGuid();
            const string category = "MemberAlert";
            var          newUrl   = url.AsNonReadOnly();

            newUrl.QueryString["userId"]   = userId.ToString("n");
            newUrl.QueryString["category"] = category;

            var newRedirectUrl = redirectUrl.AsNonReadOnly();

            newRedirectUrl.QueryString["userId"]   = userId.ToString("n");
            newRedirectUrl.QueryString["category"] = category;

            AssertRedirect(newUrl, newRedirectUrl, newRedirectUrl);
        }