What is better to use "OnBeginWebRequest" or in the preparation of the layouts

What is better to use "OnBeginWebRequest" or in the preparation of the layouts

  
Hi,

I need to make sure and set everything right when a user enters the application.
(for example, getting the roles from a external database etc.)
Since we use integrated authentication we don't get the login-page very often.
we have multiple applications, 1 common theme, multiple espaces.

option 1: OnSessionStart = impossible, since we never know when a session starts
option 2: OnbeginWebRequest = possible, but to make sure I need to have that action in every end-user espace
option 3: place it inside the preparation of the layoutwebblocks.. bit harder to check if they actually are using the layouts...

Currently I am using OnBeginWebRequest, but curious what might be a better way...

I would go for the OnSessionStart, I don't see why you say it's impossible, the OnSessinStart of the User Provider eSpace will always run right after the Session.UserId gets set. Even if it's an integrated authentication login.

That way you only need to code it once and have a guarantee that is used.

Regards,
João Rosado
hmm, I will check it.

I get the feeling it doesn't get hit sometimes when the browser has been open for a while.
I think I checked it with some audits.

for example, I also need to change the connectionstring because we are using a proxyuser in our external database. so I need to make sure that with every call my connectionstring(s) of that session are set correctly.