Try our conversational search powered by Generative AI!

Culture lost and reset to master language

Vote:
 

Culture gets lost and reset to master language when I call conrtoller's action (both with ajax and without ajax). The links below helps to fix issue on ajax call but I am getting this issue even when I do not use ajax. Also, it is very annoying to use attribute in all actions as explained in these articles.

https://world.episerver.com/forum/developer-forum/-Episerver-75-CMS/Thread-Container/2019/4/localizationculture-is-lost-upon-ajax-request/

https://stefanolsen.com/posts/ensuring-the-right-ajax-content-language-using-a-filter-attribute/

My controller action looks like below.

[HttpPost]
[ValidateAntiForgeryToken]
public async Task<ActionResult> MyAction(MyModel model)
#210828
Edited, Dec 07, 2019 6:26
Vote:
 

What does controller action look like?

#210831
Dec 08, 2019 10:31
Muller - Dec 08, 2019 13:53
I have updated the question.
Quan Mai - Dec 08, 2019 21:06
You will need to provide more than that (i.e. full action code) to clear your question - how does "culture get lost"?
Muller - Dec 09, 2019 3:20
@Quan Mai Culture is lost before executing action code. So, the code inside should not make difference.
Vote:
 

Are you using an API controller? This won't know what culture you're calling it from unless you tell it explicitly / reset it based on the users cookies

#210900
Dec 10, 2019 12:03
Muller - Dec 12, 2019 5:34
No I am not using API controller.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.