Geting CurrentWebsiteId from addons

Hi, how can I get the current websiteId from a project that cant use RequestModelAccessor? I cant add the Litium.Accelerator as an ref because the plugin is a ref to That project.

A lot of old addons uses CurrentState.Current.WebSite.ID; What is the correct way to do this going farward? I dont realy like the look of having to send it via the constructor :smiley:

Litium version: 7.0.2

If you inject the Litium.Web.Routing.RouteRequestLookupInfoAccessor (registered as singelton) you can access the Litium.Web.Routing.RouteRequestLookupInfo object that have the Channel as a property, From the Channel you can get the WebsiteSystemId.

The Litium.Web.Routing.RouteRequestLookupInfo will be extended with additional properties for website, culture, uiCulture etc to make it easier to extend the Litium.Web.Routing.IChannelResolver to example fetch the current display culture from a cookie instead of the one that are set for the website.

2 Likes

Fantastic! Thanks!