Session with Idle timeout - but how to define actions without saving?

Is it possible to configure an ASP.NET web application (MVC) to have a session timeout (idle timeout) that is not affected by certain web requests (for example, some AJAX requests)?

I know that the following is possible:

<system.web>
  <sessionState mode="InProc" timeout="5"/></sessionState>
</system.web>

Thus, the session expires after 5 minutes of inactivity (i.e. does not make any web requests).

In addition, there is an attribute that allows you to enable / disable a session for a specific controller:

[SessionState(SessionStateBehaviour.Disabled)] 
public class MyController : Controller   
{ 
}

Although, I am interested in defining an action whose call does not in any way participate in the session timeout, but, nevertheless, it can access session variables.

That is, I would like to define an action that, if invoked, does not support the session , does not shift the session interval, but can read session variables.

? , :)

, :

-, , , ?

:

: -

+4

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


All Articles