private void CheckSameSite(HttpContext httpContext, HttpCookie cookie) { if (cookie.SameSite == SameSiteMode.None) { var userAgent = httpContext.Request.UserAgent; if (BrowserDetection.DisallowsSameSiteNone(userAgent)) { cookie.SameSite = (SameSiteMode)(-1); } } }
private static string Browser(NameValueCollection headers) { var ua = headers["HTTP_USER_AGENT"] ?? headers["User-Agent"]; if (ua != null) { return(BrowserDetection.Detect(ua)); } return(null); }
private void CheckSameSite(HttpContext httpContext, CookieOptions options) { if (options.SameSite == SameSiteMode.None) { var userAgent = httpContext.Request.Headers["User-Agent"].ToString(); // TODO: Use your User Agent library of choice here. if (BrowserDetection.DisallowsSameSiteNone(userAgent)) { options.SameSite = (SameSiteMode)(-1); //options.SameSite = SameSiteMode.Unspecified; } } }
private static string Browser(HttpContext context) { var ua = context?.Request?.Headers["User-Agent"].ToString(); return(BrowserDetection.Detect(ua)); }