Say you managed to make the session read-only by applying a [SessionState(System.Web.SessionState.SessionStateBehavior.ReadOnly)]
on a controller.
When modifying the session within that controller, it seems like changes will only last for the duration of the current request and will be silently discarded by the beginning of the next request.
I tried to search for a way to throw an exception when attempting to modify the session within that controller, rather than silently ignoring the changes, but failed to find one. It seems like there might be something to do with HttpSessionStateWrapper
and IHttpModule
, but I can’t get this to work. Is there any way to acheive this ?
Thank you.