Activities of "thomas.blotiere@abraxas.ch"

Hello Muhammed,

I thank you for your message. I have tested your suggested changes and it is working.

Should this change incorporated in ABP next version as well ? I do not quite understand why this language cookie is pretty much the only cookie missing path=/ .

Thomas

I would think so, cf screenshot

Hello Albert,

So I went digging for my whole day yesterday into ABP and ABP commercial source code and I have found the issue :

The script that is responsible for setting the cookie is missing something :

function setLanguageToCookie(injector) { return () => { const sessionState = injector.get(SessionStateService); const document = injector.get(DOCUMENT); const cookieLanguageKey = injector.get(COOKIE_LANGUAGE_KEY); sessionState.getLanguage$().subscribe(language => { const cookieValue = encodeURIComponent(c=${language}|uic=${language}); document.cookie = ${cookieLanguageKey}=${cookieValue}; }); };

If the path of the cookie is not specified then it is assigned to the path of the current page, which causes the problem in my case ; thus the fix (tested) is to change the line :

document.cookie = ${cookieLanguageKey}=${cookieValue};

to

document.cookie = ${cookieLanguageKey}=${cookieValue};path=/;

I did change manually the generated script (main.js) on the server to test but I do not know where I should do this change for a clean fix.

Could you tell me in which file I should do the change before compiling ?

Thanks

Thomas

Hello Albert,

I am sorry but I could not test as we have a blocking issue with the build since thursday . I will test what you have suggested as soon as I can.

Thomas

Hello Albert,

Thank you for the answer. I'll test it asap.

Thomas

We can do a Teams or TeamViewer session if that helps. Just send me an email.

Thanks

I have tried in incognito mode, no luck, same behavior.

You woud not have access to our integration server for security reasons ; I have tried from home, it does not work.

The culture (with / path) can be already set by other domain before you navigate to sub-domain.

This is probably true. The cookie with path '/' is set up at login. The cookie with the path /Centraltools/masterdata is set up at login and updated when I use the switch language feature.

Still I have no clue on how to advance from here. I was thinking maybe, I have to override the switch language cookie creation mechanism or on the contrary block the creation of the cookie with root '/'.

Any suggestion is welcome.

Thanks

Thomas

  • ABP Framework version: v5.1.2
  • UI type: Angular and MVC
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"
  • Log in
  • When on the Home page or any other page, try to switch the language -> some elements are updated in the target language but most don't

As you can see in the screen shot, there are 2 cookies .AspNetCore.Culture : one with path /CentralTools/Dev/masterdata and another with path /

After login, both of them have the same value, for example French.

When I change the language to English, only the one with the /CentralTools/Dev/masterdata path gets updated.

If I delete the other one (with path /) then everything works well ; I can change language any time, it is ok. But obviously we are not going to ask users to delete manually the cookie each time they log in...

What would you suggest to address this issue ?

Thanks,

Thomas

PS : This issue doe not happen locally or if the website is deployed at the root with IIS.

After digging more with how ressources are loaded and when, I understand my mistake.

The CreateCacheItem method is already called for every resource ; by adding those dictionaries, I was making many unnecessarily calls.

For some reason, the exact code https://support.abp.io/QA/Questions/1642/Is-there-a-way-to-bypass-Tenant-for-Translations#answer-eea69656-8bb0-af79-e8fb-39fe16c17820 did not work when I first tried it 2 months ago ( bad copy paste ?) but now it is working.

Thank you

At first, I only added a few needed ressources.

But then I found out that many translations were missing.

It is not always clear to me what resource abp uses to get translations but after adding resources one by one, I ended up adding all ABP resources, just in case as there was always one ressource missing each time I tested.

Concerning the resources on our side, I can remove 2 at most.

Showing 1 to 10 of 13 entries
Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11