Five New Optimizely Certifications are Here! Validate your expertise and advance your career with our latest certification exams. Click here to find out more

Write plugin that gets called on every page load

Vote:
0

Hi,

I want to write a plugin that is executed for each call to a page (non admin).

Is that possible?

Kind regards,

Sascha

#199730
Dec 07, 2018 14:44
Vote:
1

Hi Sascha,

You could register an IActionFilter or IResultFilter (depending on your requirements).

They do something similar in the Alloy demo site to add some layout information to the model, take a look at the PageContextActionFilter.cs: here they identify it was a page using the IPageViewModel interface. You can see how that is registered in the solution as well.

Hopefully it provides some inspiration.

/Jake

#199735
Edited, Dec 07, 2018 19:11
* 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.