public Task Invoke(IOwinContext context, ActionData actionData)
        {
            var cookieData = JsonConvert.SerializeObject(actionData, _serializerSettings);

            context.Response.Cookies.Append(_cookieName,
                                            cookieData,
                                            new CookieOptions
            {
                Domain   = _customCookieDomain ?? GetDefaultCookieDomainForContext(context),
                HttpOnly = false,
                Secure   = false
            });

            if (_optionalRedirectUrl != null)
            {
                context.Response.Redirect(_optionalRedirectUrl);
            }

            return(Task.CompletedTask);
        }
Exemple #2
0
        public Task Invoke(IOwinContext context, ActionData actionData)
        {
            var location = new StringBuilder(_baseUrl);

            if (!_baseUrl.EndsWith("#"))
            {
                location.Append(_baseUrl.Contains("#") ? "&" : "#");
            }

            var fragmentData = JsonConvert.SerializeObject(actionData, _serializerSettings);

            if (_useBase64Encoding)
            {
                fragmentData = Convert.ToBase64String(Encoding.UTF8.GetBytes(fragmentData));
            }
            location.Append(_fragmentParameterName);
            location.Append("=");
            location.Append(Uri.EscapeDataString(fragmentData));

            context.Response.Redirect(location.ToString());
            return(Task.CompletedTask);
        }