Advertisement
Guest User

Untitled

a guest
Sep 15th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. public IActionResult SyncCookies() {
  2. foreach(string cookieName in Request.Cookies.Keys) {
  3. string pattern = @ "^(_vis_opt_|_vwo).*";
  4. Regex regex = new Regex(pattern, RegexOptions.IgnoreCase);
  5. Match match = regex.Match(cookieName);
  6. if (match.Success) {
  7. string cookieValue = Request.Cookies[cookieName];
  8. CookieOptions option = new CookieOptions();
  9. UInt64 expiry = 315360000000 UL;
  10. // Expire any VWO cookies after 10 years.
  11. // Set the cookie on root path so that it's accessible on all paths
  12. // Set the domain to .<eTld+1>
  13. option.Expires = DateTime.Now.AddMilliseconds(expiry);
  14. option.Path = "/";
  15. option.Domain = ".<eTld+1";
  16. Response.Cookies.Append(cookieName, cookieValue, option);
  17. }
  18. }
  19. Response.Headers.Add("Access-Control-Allow-Origin", "*");
  20. return Ok();
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement