public static void AddCookie(OwinResponse response, string key, string value, CookieOptions options) { if (options == null) { throw new ArgumentNullException("options"); } var domainHasValue = !string.IsNullOrEmpty(options.Domain); var pathHasValue = !string.IsNullOrEmpty(options.Path); var expiresHasValue = options.Expires.HasValue; var setCookieValue = string.Concat( Uri.EscapeDataString(key), "=", Uri.EscapeDataString(value ?? string.Empty), !domainHasValue ? null : "; domain=", !domainHasValue ? null : options.Domain, !pathHasValue ? null : "; path=", !pathHasValue ? null : options.Path, !expiresHasValue ? null : "; expires=", !expiresHasValue ? null : options.Expires.Value.ToString("ddd, dd-MMM-yyyy HH:mm:ss ", CultureInfo.InvariantCulture) + "GMT", !options.Secure ? null : "; secure", !options.HttpOnly ? null : "; HttpOnly"); response.AddHeader("Set-Cookie", setCookieValue); }
public static void AddCookie(OwinResponse response, string key, string value) { response.AddHeader("Set-Cookie", Uri.EscapeDataString(key) + "=" + Uri.EscapeDataString(value) + "; path=/"); }
public override Task Invoke(OwinRequest request, OwinResponse response) { response.AddHeader("X-ApplicationVersion", BuildInfo.Version.ToString()); return(Next.Invoke(request, response)); }
public static void AddChallenge(AuthenticationHeaderValue challenge, OwinResponse response) { response.AddHeader("WWW-Authenticate", challenge.ToString()); }