Don't miss out Virtual Happy Hour this Friday (April 26).

Try our conversational search powered by Generative AI!

Attach provider for page requests

Vote:
 

Hi,

Im wondering how to attach a provider to run before a page is rendered. I want to check if a page is of a certain page type and if it is I then want to handle it with my logic. Anyone has an example?

#82176
Mar 06, 2014 13:40
Vote:
 

I can also point out that if a page dosent have a view/template I want to handle this too.

#82177
Mar 06, 2014 13:43
Vote:
 

One way is to hook up an eventhandler to EPiServer.Web.TemplateResolver.TemplateResolving (or TemplateResolved) and there set which template to use. See http://world.episerver.com/Modules/Forum/Pages/Thread.aspx?id=79313

You can get the instance of TemplateResolver from IOC container.

#82184
Mar 06, 2014 16:32
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.