JG Vimalan's Blog

It is all about coding!

HttpContext.Current.Session is null in http handler

I often see developers complaing about HttpContext.Current.Session is null in httphandler.

All you need to do is, implement System.Web.SessionState.IReadOnlySessionState if http handler requires read only access to session – state values.

or else, implement IRequiresSessionState, if you want read and write access to session state variables.

public class Member: IHttpHandler, IRequiresSessionState
{
}

this will solve the issue.

Advertisements

June 18, 2011 - Posted by | ASP.NET, C#.NET

No comments yet.

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

%d bloggers like this: