Is there a way to call a server action when any page loads? Like .NET?

Can Screens "inherit" from a base page? We're implementing security and I want every single access to the system to go through a security engine. Ideally, I'd like this to happen without copy/pasting a server action into every Preparation.

What's the best way to do this in Outsystems?


Hi PJ,

You can add the OnBeginWebRequest system event to do this.

To do this:

  1. Go to Logic tab
  2. On Server Actions folder right click and choose System  Events -> On Begin Request

You can "inherit" also from a "base" page kinda, by implementing a layout webblock that you use as bases for your pages, so you code the logic in the webblock and use it as starting point for your screens (As does the default themes like lisbon, etc.)




That's PERFECT!  Thank you!


I'm curious... anything particular regarding Screen roles, User logins, SSL enforcement, etc. that don't satisfy your security needs?



We need more fine grained control than at the page level. For example, we need to control who can edit records or see particular portions of a screen. We also want to hide access to the pages if the user can't see them, which we can't do with out of the box security protocols.

As I suspected it seems to me you're taking the hardest path.

You can achieve grained control without logic in OnBeginWebRequest.

Take a look at this component as an example of how to do what you want (I think...).



That looks really cool João! I think for our case, since we only need to secure a few webblocks it'd be overkill but I totally love the way it works!

Well, let me just say that overkill is using OnBeginWebRequest to run logic for a few web blocks.

That code will run in every single request to the server! Regardless if it's the page(s) with the web blocks or not.