Share Localization cookies with other application #13941
-
Hi
Also i added the storage all the keys wirh data protection but does not working to share the language with other applications
Is there a way on the ِAbp to solve this problem? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
hi You can change the domain of cookies.
public static IServiceCollection ConfigureShareCultureCookies(this IServiceCollection services)
{
services.Configure<CookiePolicyOptions>(options =>
{
options.OnAppendCookie = cookieContext =>
{
SetCultureCookieDomain(cookieContext, null);
};
options.OnDeleteCookie = cookieContext =>
{
SetCultureCookieDomain(null, cookieContext);
};
});
return services;
}
private static void SetCultureCookieDomain(AppendCookieContext appendCookieContext, DeleteCookieContext deleteCookieContext)
{
if (appendCookieContext != null)
{
if (appendCookieContext.CookieName == CookieRequestCultureProvider.DefaultCookieName && Consts.SharedCookieDomain != null)
{
appendCookieContext.CookieOptions.Domain = Consts.SharedCookieDomain;
}
}
if (deleteCookieContext != null)
{
if (deleteCookieContext.CookieName == CookieRequestCultureProvider.DefaultCookieName && Consts.SharedCookieDomain != null)
{
deleteCookieContext.CookieOptions.Domain = Consts.SharedCookieDomain;
}
}
} https://www.c-sharpcorner.com/article/asp-net-core-cookie-sharing-authentication/ |
Beta Was this translation helpful? Give feedback.
-
Hi Can save in settings the language for each user when selected the language like aspnetboilerplate?? |
Beta Was this translation helpful? Give feedback.
hi
You can change the domain of cookies.
Consts.SharedCookieDomain
can be.example.com