开发者

ASP.NET Reusable Handlers and Session State

开发者 https://www.devze.com 2023-01-28 13:33 出处:网络
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.

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

精彩评论

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

关注公众号