ASP.NET: How to access Session from handler? [duplicate] ASP.NET: How to access Session from handler? [duplicate] asp.net asp.net

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");        }}


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);    }