Can an ASP.NET Handler (.ashx) that implements IRequiresSessionState be reusable or will it persist its relationship with the first Session used?
Can an ASP.NET Handler (.ashx) that implements IRequiresSessionState be reusable or will it persist
Share
Yes, it can be reusable.
Callers pass session state inside the
HttpContextwhen they invoke theProcessRequestmethod. Method parameters are only available within the scope of each method invocation, not across multiple invocations on different threads.Ultimately, it depends on your
ProcessRequestimplementation, 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.