ASP.NET Generic Handlers & Session
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");
}
}
You can use this:
public class Handler :
IHttpHandler,
System.Web.SessionState.IReadOnlySessionState
Generic handlers must implement the IReadOnlySessionState
interface to access session variables. If you also need to write session variables, implement IRequiresSessionState
.