Join us this Friday for AI in Action at the Virtual Happy Hour! This free virtual event is open to all—enroll now on Academy and don’t miss out.

 

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.