1

I have one site collection where I need a data from Session Storage. So I enable my Session from web.config. I know it is not recommended Session in Sharepoint, but my client needs it.

So Basically My need is I have two login option one with SharePoint default login which is working perfectly fine. but in second option I am using form based authentication. its also working fine, but the problem is when I logged for the first time then I Set one Session variable. the basis of that variable I am calling one web service outside of SharePoint which is returning with my username.

when I refresh my page after 4-5 hours session is set to null because of a session timeout. Can we set SharePoint Session timeout same as SharePoint default logout time? if yes please suggest something. I already follow this link, but unfortunately, it is not working for me.

0

You need to do that in web.config of our application under sessionstorage section:

          <sessionState mode="Off|InProc|StateServer|SQLServer"
          cookieless="true|false"
          timeout="number of minutes"
          stateConnectionString="tcpip=server:port"
          sqlConnectionString="sql connection string"
          stateNetworkTimeout="number of seconds"/>
0

Use PowerShell to set the TimeOut Value:

$SPSite = Get-SPSite("[your site collection]")
$webApp = $SPSite.WebApplication
$webApp.Enabled = $true
$webApp.Expires = $true
$webApp.Timeout = New-TimeSpan -Hours 2 -Minutes 30
$webApp.Update()

How to change the session timeouts in SharePoint sites

  • Tried not working for me – Negi Rox Jan 24 '18 at 18:31
  • There doesn't seem to be a $webApp.Enabled, $webApp.Expires, or $webApp.Timeout – Nullldata Sep 25 '18 at 13:10
0

Maybe this is a solution for you (needs to be changed in your web.config):

<forms name=”name” 
      loginUrl=”url”—————————- This was configured when you configured FBA
      protection=”All|None|Encryption|Validation”
      timeout=”30″ ————————— This is the default expiration (set it here at your convenience)
      path=”/” 
      requireSSL=”true|false”
      slidingExpiration=”true|false”>
  <credentials passwordFormat=”format”/>
</forms>

https://blogs.technet.microsoft.com/victorbutuza/2008/08/26/forms-based-authentication-timeout/

0

Not really sure if that can help you, but I use this function to refresh active sessions:

    function refreshDigestToken() {
    $.ajax({
        url: _spPageContextInfo.webAbsoluteUrl + "/_api/contextinfo",
        method: "POST",
        headers: {
            "Accept": "application/json; odata=verbose"
        },
        success: function (data) {
            $('#__REQUESTDIGEST').val(data.d.GetContextWebInformation.FormDigestValue);
        },
        error: function (data, errorCode, errorMessage) {
            console.log(errorMessage);
        }
    });
}

That way the token should automatically be used for further actions. I have that function on a timer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.