예제 #1
0
        public AntiForgeryData SetCookieToken(string path, string domain)
        {
            var             applicationPath = (string)_requestData.Value("ApplicationPath");
            AntiForgeryData token           = GetCookieToken();
            string          name            = _tokenProvider.GetTokenName(applicationPath);
            string          cookieValue     = _serializer.Serialize(token);

            var newCookie = new HttpCookie(name, cookieValue)
            {
                HttpOnly = true, Domain = domain
            };

            if (!string.IsNullOrEmpty(path))
            {
                newCookie.Path = path;
            }
            _outputWriter.AppendCookie(newCookie);

            return(token);
        }
예제 #2
0
        public AntiForgeryData SetCookieToken(string path, string domain)
        {
            var             applicationPath = _fubuApplicationFiles.RootPath;
            AntiForgeryData token           = GetCookieToken();
            string          name            = _tokenProvider.GetTokenName(applicationPath);
            string          cookieValue     = _serializer.Serialize(token);

            var newCookie = new Cookie(name, HttpUtility.UrlEncode(cookieValue))
            {
                HttpOnly = true, Domain = domain
            };

            if (!string.IsNullOrEmpty(path))
            {
                newCookie.Path = path;
            }
            _outputWriter.AppendCookie(newCookie);

            return(token);
        }