MY friend asked here a question
And the one who answered him - wrote something interesting ! ( without any proof , source).
It makes a bigger difference when you're using out-of-process session state storage. In that case, without the interface, the system will still store the session data in the remote database, even when it hasn't changed (the system doesn't keep track of whether the session data was modified during the request). When you use the IReadOnlySessionState interface, the write-back phase is skipped.
Where Does it say that IRequiresSessionState will write back the session ( even if hadent changed.) ?
any explanations will be gladly excepted.
Can't find formal documentation to this effect, but firing up dotPeek (or some other disassembler) and having a look around System.Web
successively reveals that:
HttpContext.Handler
is set
, if the handler implements IRequiresSessionState
, HttpContext._requiresSessionStateFromHandler
is set true
;get
ter for HttpContext.RequiresSessionState
;SessionStateModule
(which I am gong to guess is always in the module pipeline), in its EndRequest
handler, checks HttpContext.RequiresSessionState
, and if it's true
, talks to the session state provider to save state.