Some cases, our clients (SharePoint Client) may request to change the session time out of SharePoint sites. It is allowed to set timeout of the user session in SharePoint so that users are logged out after certain time of inactivity. Additionally, current page state will be expired based configure timeout. There are multiple ways, we can configure session timeout.

From central Administrator:

Go to SharePoint  Central Admin
Go to Application Management
Select Configure Session State
Under Timeout, change the default value stored there.

Power Shell ( SharePoint Management Shell)

This is handy for forms which have to be filled within certain period of time before they expire. Alternatively, if you want to extend the timeout – you can do that.

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

This will enable session expiration and set page content to timeout after 2 hours and 30 minutes.

If you’re using claims authentication and would like for your provider to expire sessions after certain period of inactivity, here is how to do that with Power Shell:

$tokenservice = Get-SPSecurityTokenServiceConfig
$tokenservice.UseSessionCookies = $true
$tokenservice.LogonTokenCacheExpirationWindow = New-TimeSpan -Minutes 5
$tokenservice.Update()

Logon expiry will be set to 5 mins.

By Rijwan Ansari

Research and Technology Lead | Software Architect | Full Stack .NET Expert | Tech Blogger | Community Speaker | Trainer | YouTuber. Follow me @ https://rijsat.com Md Rijwan Ansari is a high performing and technology consultant with 10 plus years of Software Development and Business Applications implementation using .NET Technologies, SharePoint, Power Platform, Data, AI, Azure and cognitive services. He is also a Microsoft Certified Trainer, C# Corner MVP, Microsoft Certified Data Analyst Associate, Microsoft Certified Azure Data Scientist Associate, CSM, CSPO, MCTS, MCP, with 15+ Microsoft Certifications. He is a research and technology lead in Tech One Global as well as leading Facebook community Cloud Experts Group and SharePoint User Group Nepal. He is a active contributor and speaker in c-sharpcorner.com community, C# Corner MVP and his rank at 20 among 3+ millions members. Additionally, he is knee to learn new technologies, write articles, love to contribute to the open-source community. Visit his blog RIJSAT.COM for extensive articles, courses, news, videos and issues resolution specially for developer and data engineer.

Leave a Reply

Your email address will not be published. Required fields are marked *