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 616f52fe4727..45a422e10e3c 100644
--- a/src/Microsoft.AspNet.Session/SessionMiddleware.cs
+++ b/src/Microsoft.AspNet.Session/SessionMiddleware.cs
@@ -126,7 +126,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