Take the community feedback survey now.
AI OnAI Off
Take the community feedback survey now.
Hi
Could you use HttpApplication.BeginRequest event?
[ModuleDependency(typeof(InitializationModule))]
public class SampleInitializer : IInitializableHttpModule
{
public void InitializeHttpEvents(HttpApplication application)
{
application.BeginRequest += ApplicationOnBeginRequest;
}
private void ApplicationOnBeginRequest(object sender, EventArgs eventArgs)
{
// You can access episerver APIs with ServiceLocator
var contentRepository = ServiceLocator.Current.GetInstance<IContentRepository>();
// TODO your code here
throw new NotImplementedException();
}
public void Initialize(InitializationEngine context)
{
}
public void Uninitialize(InitializationEngine context)
{
}
}
Hi,
Having tried to access the EPiServer API from global.asax and failed I was wondering how I might go about adding some code that will be executed every time asp.net creates a new session (Session_Start in global.asax).
If that is impossible then how can I hook up some code that is executed on every request (as early as possible in the pipeline, similar to Application_BeginRequest) and has access to the episerver api.
Thanks.