Pages events

The following articles describes the events exposed by pages in Sitefinity CMS.

IUnauthorizedPageAccessEvent

This interface is implemented by all events which fire when a page in the site is accessed by an unauthenticated user. There's only one such built-in event, but you should always subscribe using the interface rather than the class that implements it. Use the following code to subscribe.

In the event handler, you can access the following information:

  • The HTTP Context for the page which was accessed.
  • The PageSiteNode object for the page itself.
  • The redirect strategy used.
  • The URL to which the user was redirected.

IForbiddenPageAccessEvent

This interface is implemented by events triggered when an authenticated user tries to access a restricted page. If the user is unauthenticated, the IUnauthorizedPageAccessEvent is triggered instead.

Use the following code to subscribe:

In the event handler, you can access the following information:

  • The HTTP Context for the page which was accessed.
  • The PageSiteNode object for the page itself.

IPagePreRenderCompleteEvent

An interface of the event notifying that a page's PreRender event has completed.
The event is raised at 'PreRenderComplete' event of ASP.NET page lifecycle. A subscription for this event can be created by using the EventHub. Use the following code to subscribe:

In the event handler, you can access the following information:

  • The PageSiteNode object for the page itself
  • The Page itself

Personalized pages events

IPersonalizedWidgetRenderEvent 

If the visitors browsing the page are associated with certain audience segments and in case the page has personalized versions of widgets created for these specific segments, the IPersonalizedWidgetRenderEvent is fired. The event is fired for each personalized widget.

Since there is just one such built-in event, you always subscribe using the interface rather than the class that implements it. Use the following code to subscribe:

In the event handler, you can access the following information:

  • Segment name
  • Widget ID
  • Page URL
  • Origin from where the event is fired

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?

Next article

Profile events