I would like to have a sitecore task to run differently depending on the current site. My task is scheduled to run every 24h to regenerate the sitemap.xml file. Im working on a multisite environement where I have different domains :
The problem is, when I launch my task from cn.DOMAIN.com, the
Sitecore.Context is not set to my CN site, the language is not and even when using
Sitecore.Globals.ServerUrl Im getting the base website url (DOMAIN.com) instead of the CN one.
My goal is to get the domain or the language of the site, FR for fr.DOMAIN.com or CN for cn.DOMAIN.com, to generate my sitemap.xml for each of my website in the correct language.
Any tips ?