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.
精彩评论