SHARE
TWEET

Untitled

a guest Jul 18th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.Run(async context => {
  2.                 var currentCulture = context.Request.Cookies[".AspNetCore.Culture"];
  3.                 if (!string.IsNullOrEmpty(currentCulture) && currentCulture.Length >= 4)
  4.                 {
  5.                     currentCulture = currentCulture.Substring(2, 2);
  6.                 }
  7.                 else
  8.                 {
  9.                     currentCulture = "es";
  10.                 }
  11.  
  12.                 context.Response.Cookies.Append(
  13.                             CookieRequestCultureProvider.DefaultCookieName,
  14.                             CookieRequestCultureProvider.MakeCookieValue(new RequestCulture(currentCulture)),
  15.                             new CookieOptions { Expires = DateTimeOffset.UtcNow.AddYears(1) }
  16.                         );
  17.             });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top