I created simple HttpModule
, all what I need is just get is valid Sitecore.Context
inside but during processing I see that my Sitecore.Context
is some kind of default.
I can get Sitecore user that log in to Sitecore, etc. How to fix it ?
I created simple HttpModule
, all what I need is just get is valid Sitecore.Context
inside but during processing I see that my Sitecore.Context
is some kind of default.
I can get Sitecore user that log in to Sitecore, etc. How to fix it ?
I assume you have a Sitecore Context, but it is null or set to the wrong site or language. You can change the context like this:
// switch to the preferred site
Sitecore.Context.SetActiveSite("yourSiteName");
// set the preferred database
Sitecore.Context.Database = Sitecore.Configuration.Factory.GetDatabase("master");
// set the preferred language
Language language = Sitecore.Globalization.Language.Parse("en");
Sitecore.Context.SetLanguage = (language, false);
You probably also want to switch back to the original settings after your processing is done. So it is wise to "save" the original settings in a variable so you can change them back afterwards
Take a look at John West's posts on Sitecore pipelines for some background on how the context is being established.
and
The following blog post on creating and running custom pipelines should give you an idea how to implement your own pipeline.
http://adeneys.wordpress.com/2008/08/27/creating-and-running-custom-pipelines-in-sitecore/