Access to Session State from Http Handler

Sometimes you need to use Http handlers to respond to requests rather than classical asp.net pages. At that times if you want to use session objects you will see that HttpContext.Current.Session is null.

If you want to read session state from you http handler your http handler must implement System.Web.SessionState.IReadOnlySessionState interface. If you want to modify the session state you can implement System.Web.SessionState.IRequiresSessionState.

Sample:

public class Login : IHttpHandler, SessionState.IRequiresSessionState

Happy coding.

Posts created 141

Leave a Reply

Related Posts

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top