adsense

Tuesday, April 23, 2013

use Session variable in an HttpHandler

In order to use session variables inside an  HttpHandler implement the IRequiresSessionState(System.Web.SessionState namespace) interface

E.g.
 public class AutoSuggest : IHttpHandler, IRequiresSessionState
{
   public void ProcessRequest(HttpContext context)
  {
      context.Session["session_name"] ="xyz";
   }
}

Cheers
Samitha.