Don't miss out Virtual Happy Hour this Friday (April 26).
Try our conversational search powered by Generative AI!
AI OnAI Off
Don't miss out Virtual Happy Hour this Friday (April 26).
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.