Workaround:
- Have a session variable like
UserIsVerified
or something
- Set this variable to
true
when logging in through the default loginpage (or through single sign on etc.)
- Create the method
Application_PreRequestHandlerExecute
in global.asax where you verify whether the UserIsVerified
prop has been set, and if not: do the appropriate checks
Why Application_PreRequestHandlerExecute?
On PreRequest both session and profile are available. .Net already has interpreted the persistent cookie, and therefore every information you can possible want is there. You can also do a Redirect when the user check fails as we are in the request cycle. It also happens right before any user code is executed, so afaik it's quite safe to do it here to prevent actions like such.
If authentication fails in the handler, I redirect to the logout page and let .Net take care of everything else.