title: Fetching session state without sending HTTP request from front end
body: <p>Setup ASP.NET Core with Reactjs + Redux + Saga. It needs to notify the user when asp.net core session is expired. But the problem is by sending GET requests to check the session status we extend the session which means the session will not ever be over unless the tab in the browser will be closed(then GET requests won't be sent). This is the session setup <code>Startup.cs</code></p>
  
  <pre><code>services.AddSession(options =&gt;
              {
                  options.IdleTimeout = TimeSpan.FromSeconds(60 * 60);
                  options.Cookie.HttpOnly = true;
              });
  </code></pre>
  
  <p>And then we send every 5 minute request from client to get identity:</p>
  
  <pre><code>function* checkSessionIsValid() {
      try {
          const response = yield call(axios.get, 'api/Customer/FetchIdentity');
  
              if (!response.data) {
                  return yield put({
                      type: types.SESSION_EXPIRED,
                  });
  
              yield delay(300000);
              return yield put({ type: types.CHECK_SESSION_IS_VALID });
          }
          return;
      } catch (error) {
          return;
      }
  }
  </code></pre>
  
  <p>And the backend endpoint(_context is <code>IHttpContextAccessor</code>):</p>
  
  <pre><code>        [HttpGet("FetchIdentity")]
          public LoginInfo GetIdentity()
          {
              if (SessionExtension.GetString(_context.Session, "_emailLogin") != null)
              {
                  return new LoginInfo()
                  {
                      LoggedInWith = "email",
                      LoggedIn = true,
                      Identity = ""
                  };
              }
  
              return null;
          }
  </code></pre>
  
  <p>So we get session info from <code>SessionExtension</code>. But probably there is some way of getting it without connecting to the back end?</p>