I have a handler, like this, using IRequiresSessionState:
public class MyHandler : IHttpHandler, IRequiresSessionState
{
// code
}
In the cod
Finally got a solution to this... sort of.
I abandoned trying to get the handler to do the job, and instead called a normal ASPX page. In that page, I removed the HTML code, and used Response.Write(...) to send back some JSON that I wanted. However, even with that, my session was not being extended!
I finally realized that in the PreRender event, I used Response.ClearHeaders()
. That was the problem. It turns out that the Forms authentication system was updating the session ticket cookie when needed, but was adding it to the Headers before my code was running. So when I cleared the headers, I was erasing the new cookie before it was sent to the browser.
So, if you are having problems with sessions not being extended, check to make sure that your code is not using ClearHeaders()
!