public void Append(string key, string value, CookieOptions options)
 {
     Microsoft.Owin.CookieOptions owinOptions = new Microsoft.Owin.CookieOptions {
         Path     = options.Path,
         Domain   = options.Domain,
         Secure   = options.Secure,
         HttpOnly = options.HttpOnly,
         Expires  = options.Expires
     };
     _cookies.Append(key, value, owinOptions);
 }
Beispiel #2
0
        /// <summary>
        /// Set site cookie language value
        /// </summary>
        /// <param name="language">Language code</param>
        public void SetCookieLanguage(string language)
        {
            if (string.IsNullOrEmpty(language))
            {
                throw new ArgumentNullException("language");
            }

            _responseCookies.Append(CookieLanguageFieldName, language, new CookieOptions {
                Expires = DateTime.Now.AddYears(5)
            });
        }
        // Invoked once per request.
        public Task Invoke(IOwinContext context)
        {
            ResponseCookieCollection cookies = context.Response.Cookies;

            cookies.Append("OwinCookieKey", "OwinCookieValue");

            Uri.TryCreate(@"C:\Users", UriKind.Absolute, out Uri uriValue);
            PathString path  = PathString.FromUriComponent(uriValue);
            bool       check = path.Equals(new PathString(@"/C:/Users"));

            context.Response.ContentType = "text/plain";
            return(context.Response.WriteAsync("Hello World " + check));
        }
Beispiel #4
0
 public void Add(string key, string value)
 {
     _cookies.Append(key, value);
 }