HttpHandler and Session State

I migrated some of my aspx Pages to ashx HttpHandlers, as they implemented downloads of text data or images, and were not really “pages”.

Since my code relies on session data (current user, selected client, selected language), the HttpHandlers also need to access session data.

By default, the HttpContext.Session field of a HttpHandler is null. To access your session data, you have to include the interfaces IRequiresSessionState or IRequiresReadOnlySessionState in your HTTP handler class.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: