views:

30

answers:

1

I just implemented a handler that uses IReadOnlySessionState and was wondering why this marker interface is needed. (I understand that it is needed in order to access Session variables, my question is why is this from a framework designer's perspective) My thinking is that it is so handlers can be as lean as possible, requiring them to "opt-in" if they want to make use of session-state, but I'm wondering if perhaps I'm missing something else.

+2  A: 

Yes, AFAIK, you are correct. Both IReadOnlySessionState and IRequiresSessionState are marker interfaces that protect you from making your handler heavier, and slower.

The difference between them is only the write status of the session.

SWeko