Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public IActionResult SyncCookies() {
- foreach(string cookieName in Request.Cookies.Keys) {
- string pattern = @ "^(_vis_opt_|_vwo).*";
- Regex regex = new Regex(pattern, RegexOptions.IgnoreCase);
- Match match = regex.Match(cookieName);
- if (match.Success) {
- string cookieValue = Request.Cookies[cookieName];
- CookieOptions option = new CookieOptions();
- UInt64 expiry = 315360000000 UL;
- // Expire any VWO cookies after 10 years.
- // Set the cookie on root path so that it's accessible on all paths
- // Set the domain to .<eTld+1>
- option.Expires = DateTime.Now.AddMilliseconds(expiry);
- option.Path = "/";
- option.Domain = ".<eTld+1";
- Response.Cookies.Append(cookieName, cookieValue, option);
- }
- }
- Response.Headers.Add("Access-Control-Allow-Origin", "*");
- return Ok();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement