Advertisement
Guest User

Untitled

a guest
Aug 20th, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. public async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
  2. {
  3. {
  4. string empId = context.RouteData.Values[RouteValues.EmployerAccountId]?.ToString().ToUpper();
  5.  
  6. const string StrictCookieKey = "strictCookie";
  7. const string LaxCookieKey = "laxCookie";
  8.  
  9. string strictCookie = context.HttpContext.Request.Cookies[StrictCookieKey]?.ToString();
  10. string laxCookie = context.HttpContext.Request.Cookies[LaxCookieKey]?.ToString();
  11.  
  12. context.HttpContext.Response.Cookies.Append(StrictCookieKey, "XXX", new CookieOptions
  13. {
  14. Secure = false,
  15. SameSite = SameSiteMode.Strict,
  16. HttpOnly = true
  17. });
  18.  
  19. context.HttpContext.Response.Cookies.Append(LaxCookieKey, "XXX", new CookieOptions
  20. {
  21. Secure = false,
  22. SameSite = SameSiteMode.Lax,
  23. HttpOnly = true
  24. });
  25.  
  26. context.Result = new RedirectResult(context.HttpContext.Request.Path);
  27. return;
  28. }
  29. // Some unreachable code here
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement