ASP.NET: How to access Session from handler? [duplicate]
Implement the System.Web.SessionState.IRequiresSessionState interface
public class Handler : IHttpHandler, System.Web.SessionState.IRequiresSessionState
{
public void ProcessRequest(HttpContext context)
{
context.Session["StackOverflow"] = "overflowing";
context.Response.Redirect("~/AnotherPage.aspx");
}
}
Implement IRequiresSessionState
Does implementing iRequiresSessionState resolve this?
What about doing an IHttpModule instead and overriding BeginRequest?
public void Init(HttpApplication application)
{
application.BeginRequest += new EventHandler(context_BeginRequest);
}