From 177d1ffb64485268b708b1eb73aef2b555414a07 Mon Sep 17 00:00:00 2001 From: hishamco Date: Mon, 9 Mar 2015 21:14:43 +0300 Subject: [PATCH] Adds CookiePath to SessionDefaults Adds CookiePath to SessionDefaults Revert "Adds CookiePath to SessionDefaults" This reverts commit d025a89cbb555b5b92cb5de2dc848da036021301. Remove extra tab Revert "Remove extra tab" This reverts commit 80b1e4976a902a5e507702b1e46e57dec0c72da4. Change tab to spaces Adds CookiePath to SessionDefaults --- src/Microsoft.AspNet.Session/SessionDefaults.cs | 1 + src/Microsoft.AspNet.Session/SessionMiddleware.cs | 2 +- src/Microsoft.AspNet.Session/SessionOptions.cs | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Microsoft.AspNet.Session/SessionDefaults.cs b/src/Microsoft.AspNet.Session/SessionDefaults.cs index 9f06ced3f453..7fb15b355f01 100644 --- a/src/Microsoft.AspNet.Session/SessionDefaults.cs +++ b/src/Microsoft.AspNet.Session/SessionDefaults.cs @@ -8,5 +8,6 @@ namespace Microsoft.AspNet.Session public static class SessionDefaults { public static string CookieName = ".AspNet.Session"; + public static string CookiePath = "/"; } } \ No newline at end of file diff --git a/src/Microsoft.AspNet.Session/SessionMiddleware.cs b/src/Microsoft.AspNet.Session/SessionMiddleware.cs index 47ae9793f9fa..aa688113c599 100644 --- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs +++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs @@ -127,7 +127,7 @@ private void SetCookie() { Domain = _options.CookieDomain, HttpOnly = _options.CookieHttpOnly, - Path = _options.CookiePath ?? "/", + Path = _options.CookiePath ?? SessionDefaults.CookiePath, }; _context.Response.Cookies.Append(_options.CookieName, _sessionKey, cookieOptions); diff --git a/src/Microsoft.AspNet.Session/SessionOptions.cs b/src/Microsoft.AspNet.Session/SessionOptions.cs index 30c5948ed7ad..345df18d3969 100644 --- a/src/Microsoft.AspNet.Session/SessionOptions.cs +++ b/src/Microsoft.AspNet.Session/SessionOptions.cs @@ -20,7 +20,7 @@ public class SessionOptions /// /// Determines the path used to create the cookie. The default value is "/" for highest browser compatibility. /// - public string CookiePath { get; set; } = "/"; + public string CookiePath { get; set; } = SessionDefaults.CookiePath; /// /// Determines if the browser should allow the cookie to be accessed by client-side JavaScript. The