Session timeout and inactivity settings

Loading

What is Session Timeout in Power Pages?

Session Timeout defines the maximum duration a user can stay authenticated (logged in) to the portal before the session expires.
Inactivity Timeout refers to logging out a user if they remain idle (no activity) beyond a defined period.

These timeouts are important for:

  • Enhancing security by minimizing unauthorized access.
  • Complying with data protection regulations (like GDPR).
  • Reducing session misuse especially in shared environments.

Key Terminology

TermDescription
Session TimeoutDuration after which a session expires regardless of activity
Inactivity TimeoutDuration after which a session expires due to inactivity
Sliding ExpirationExtends the session expiration time if the user remains active
Token LifetimeDuration for which an authentication token is valid (mainly for Azure AD logins)

How Power Pages Manages Sessions

Power Pages leverages ASP.NET and Azure AD authentication models. The timeout settings are applied in different layers:

  1. Power Pages Site Settings
  2. Azure AD B2C / Identity Provider Settings
  3. Browser-level cookie/token expiration

🛠️ How to Configure Session Timeout

📍 1. Set Timeout in Power Pages Site Settings

You can define session timeout values through Site Settings in the Portal Management App.

Add or Modify the Following Site Settings:

NameValueDescription
Authentication/SessionTimeoutEnabledtrueEnables custom session timeout settings
Authentication/SessionTimeoutInMinutes20Sets inactivity timeout (e.g., 20 minutes)
Authentication/SessionTimeoutTypeSliding or FixedSliding resets timer on activity; Fixed does not
Authentication/SessionTimeoutWarningInMinutes2Time before timeout to show a warning popup
Authentication/SessionTimeoutRedirectUrl/sign-inPage to redirect the user to after timeout

Steps to Configure:

  1. Open Portal Management App
  2. Go to Site Settings
  3. Add each of the above settings (if not already present)
  4. Save and Publish changes

2. Configuring Timeout in Azure AD B2C (if used)

If your portal uses Azure Active Directory B2C for login:

  • Navigate to the Azure Portal
  • Go to Azure AD B2C > User Flows or Custom Policies
  • Adjust Access Token Lifetime and Refresh Token Lifetime in the Identity Experience Framework

Typical default values:

  • Access token lifetime: 1 hour
  • Refresh token lifetime: 14 days (with sliding window)

For stricter control, create a Token Lifetime Policy:

{
"TokenLifetimePolicy": {
"AccessTokenLifetime": "00:30:00",
"MaxInactiveTime": "00:20:00"
}
}

Then assign the policy to your app registration.


How the Timeout Warning Works

When Authentication/SessionTimeoutWarningInMinutes is set:

  • A JavaScript modal/popup appears in the portal warning the user that their session is about to expire.
  • Users can choose to stay signed in, which resets the timer (if Sliding type is used).
  • If no response, they are redirected after the full timeout.

Example: 30-Minute Session with Warning

SettingValue
Authentication/SessionTimeoutEnabledtrue
Authentication/SessionTimeoutInMinutes30
Authentication/SessionTimeoutTypeSliding
Authentication/SessionTimeoutWarningInMinutes5
Authentication/SessionTimeoutRedirectUrl/sign-in

Outcome:

  • User is logged out after 30 minutes of inactivity
  • At 25 minutes, a popup warns them
  • If they click “Stay signed in”, the timer resets

Best Practices

  • Use Sliding Timeout for better UX and session continuity.
  • Use Fixed Timeout for highly secure apps or where auto-logout is required by compliance.
  • Always show a warning popup to avoid data loss or user frustration.
  • Combine with CAPTCHA and Web Role/Table Permissions for layered security.
  • Customize the Redirect URL to lead users back to the login or home page.

Troubleshooting

ProblemSolution
Timeout not applyingEnsure SessionTimeoutEnabled is true
Warning not showingCheck if SessionTimeoutWarningInMinutes is lower than total timeout
Immediate logoutMisconfigured token lifetime in Azure AD
Redirect not workingConfirm the URL path in SessionTimeoutRedirectUrl is valid

Testing Timeout Behavior

  1. Login to your portal
  2. Stay idle for the defined time
  3. Observe the warning popup
  4. Either interact or wait for redirection
  5. Re-login and validate redirection

Final Notes

Session timeout control in Power Pages allows you to balance user experience and security compliance. When configured correctly, it:

  • Protects user sessions
  • Reduces unauthorized access risks
  • Ensures compliance with enterprise or regulatory policies

It’s highly recommended for any authenticated or sensitive portal project.

Leave a Reply

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