ASP.NET Generic Handlers & Session

bleepzter picture bleepzter · Feb 3, 2011 · Viewed 29.2k times · Source

I have an issue with GenericHandler and anonymousIdentification.

Basically if <anonymousIdentification enabled="true" /> is turned on in the web config, whenever a JQuery GET/POST request is sent to the server, that request executes under a new user and a new user session.

Is there a way to mitigate this? I need to access the current user's session variables... It is really frustrating!

Answer

Josh Stodola picture Josh Stodola · Feb 3, 2011

Generic handlers must implement the IReadOnlySessionState interface to access session variables. If you also need to write session variables, implement IRequiresSessionState.