HTTPHandler: IRequiresSessionState Stops Page Execution

I have an ASHX HTTPHandler that implements IRequiresSessionState. When I call this handler and call the aspx page of the same application in a different window, the aspx page does not start until the ashx page finishes processing. Even calling the same ashx page from two different windows shows that the first page starts, and then the next.

When I do not implement IRequiresSessionState, the pages load asynchronously, without waiting for the completion of another page.

This can be a serious bottleneck for the end user who would like to work in multiple windows.

The session has user data. If the above approach does not work, you need an alternative way to store user data for the session that can be used in HTTPHandler.

Additional Information: - I use the ashx handler to process and send a file that requires a session inside.

+3
source share
2 answers

, aspx . / . , .net . , . Asp.net , . , aspx. . , .

- , aspx.

, . /, (-/ ).

+4

, @Mike IRequiresSessionState, "" () , , .

, ajax ( Generic Handler - *.ashx), "" . , ( 250 ) "//" ( ). (, - ..), , , .

IRequiresSessionState ( inteface Generic Handler), ASP.NET , / . . " ", , 1- .

public class SaveDataHandler : IHttpHandler, IRequiresSessionState
{
    public void ProcessRequest(HttpContext context)
    {
        // Read request parameters
        // Read database (user specific data)
        // Process
        // Write back to database (user specific data)
    }

    public bool IsReusable => false;
}
0

Source: https://habr.com/ru/post/1756056/


All Articles