我是trying to store some values in the Session from a Handler page,我做一个重定向到一个WebForms的页面之前,将拿起会议值和预填的WebForm:ASP.NET:如何从处理程序访问会话?
public class Handler : IHttpHandler
{
public void ProcessRequest(HttpContext context)
{
...
context.Session["StackOverflow"] = "overflowing";
context.Response.Redirect("~/AnotherPage.aspx");
...
}
...
}
除了context.Session
对象为null。
如何从处理程序访问会话状态?
注意:您不必实际执行任何操作,只需将该接口添加到您的类中即可。网络服务器然后看到你在问它,并填充它。 – 2009-06-29 17:35:47
是的,它仍然在实现接口,但由于它是一个标记接口,没有任何代码我们不得不编写其他接口的派生。 – JoshBerke 2009-06-29 20:33:13