Browse Source
Set `.AspNetCore.Culture` cookie `path` to `/`.
pull/21917/head
maliming
1 year ago
No known key found for this signature in database
GPG Key ID: A646B9CB645ECEA4
2 changed files with
13 additions and
5 deletions
-
framework/src/Volo.Abp.AspNetCore.Components.Web/wwwroot/libs/abp/js/abp.js
-
modules/basic-theme/src/Volo.Abp.AspNetCore.Components.WebAssembly.BasicTheme/Themes/Basic/LanguageSwitch.razor
|
|
|
@ -36,6 +36,9 @@ var abp = abp || {}; |
|
|
|
|
|
|
|
if (path) { |
|
|
|
cookieValue = cookieValue + "; path=" + path; |
|
|
|
} else { |
|
|
|
|
|
|
|
cookieValue = cookieValue + "; path=/"; |
|
|
|
} |
|
|
|
|
|
|
|
if (secure) { |
|
|
|
|
|
|
|
@ -1,8 +1,10 @@ |
|
|
|
@using Volo.Abp.Localization |
|
|
|
@using System.Globalization |
|
|
|
@using System.Collections.Immutable |
|
|
|
@using Volo.Abp.AspNetCore.Components.Web |
|
|
|
@inject ILanguageProvider LanguageProvider |
|
|
|
@inject IJSRuntime JsRuntime |
|
|
|
@inject ICookieService CookieService |
|
|
|
@if (_otherLanguages != null && _otherLanguages.Any()) |
|
|
|
{ |
|
|
|
<BarDropdown RightAligned="true"> |
|
|
|
@ -57,20 +59,23 @@ |
|
|
|
{ |
|
|
|
await JsRuntime.InvokeVoidAsync( |
|
|
|
"localStorage.setItem", |
|
|
|
"Abp.SelectedLanguage", |
|
|
|
"Abp.SelectedLanguage", |
|
|
|
language.UiCultureName |
|
|
|
); |
|
|
|
|
|
|
|
await JsRuntime.InvokeVoidAsync( |
|
|
|
"localStorage.setItem", |
|
|
|
"Abp.IsRtl", |
|
|
|
"Abp.IsRtl", |
|
|
|
CultureInfo.GetCultureInfo(language.UiCultureName).TextInfo.IsRightToLeft |
|
|
|
); |
|
|
|
|
|
|
|
await JsRuntime.InvokeVoidAsync( |
|
|
|
"abp.utils.setCookieValue", |
|
|
|
await CookieService.SetAsync( |
|
|
|
".AspNetCore.Culture", |
|
|
|
$"c={language.CultureName}|uic={language.UiCultureName}" |
|
|
|
$"c={language.CultureName}|uic={language.UiCultureName}", |
|
|
|
new CookieOptions |
|
|
|
{ |
|
|
|
Path = "/" |
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
await JsRuntime.InvokeVoidAsync("location.reload"); |
|
|
|
|