开发者

ASP.NET Reusable Handlers and Session State

Can an ASP.NE开发者_JS百科T Handler (.ashx) that implements IRequiresSessionState be reusable or will it persist its relationship with the first Session used?


Yes, it can be reusable.

Callers pass session state inside the HttpContext when they invoke the ProcessRequest method. Method parameters are only available within the scope of each method invocation, not across multiple invocations on different threads.

Ultimately, it depends on your ProcessRequest implementation, but unless you do something very unusual (like store the session in a member variable and then use it later during the method call), each request will use the correct session even though they're sharing the handler instance.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜