November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Could you give us the background and describe the problem you are trying to solve?
I'm not sure you are on the right track here so I would like to know more before we try to help you solve your problem.
The problem in short is: We need to load templates (modal) via ajax. This template needs to be in the same language as the rest of the site.
So, I thought I could do a custom route that "deliveres" a template as a partial view. Thought that (since it it the same domain) I could access the current language.
Ok.
If you want to create you own routes for API controllers thats fine but you have to provide the language and id of the content object you want to load as parameters to your own controller. EPiServer does not know which language you prefer unless its own default routing is used.
When you type in a friendly url to an EPiServers page a lot of things happens. First it will go through the whole route table, if there is no match EPiServers default route handle will be triggerd. A rater complicated process is triggered to calculate the preferred language from hostname, the first url segment, browser language using different settings. This is nothing you want to implement yourself.
I suggest that you send the id and active language as parameters to your controller in the ajax call.
Then use IContentLoader.Get
We are building a cms site where the front end is suppose to load some templates via routes that I have setup. The thing is that I cant seem to get the current language.
I have made a custom route that looks like this:
My controller then just returns a PartialView. Is it even possible to do it like this or do I have to pass my EPi context some how?