ADFS Timeout RRS feed

  • Question

  • Hi,

    Our web application uses ADFS for authentication. The code works fine by using the valid token received from ADFS and letting authenticated users in to the application. 
    This is the code:

     user = "";        

            IClaimsPrincipal claimsPrincipal = Page.User as IClaimsPrincipal;

            IClaimsIdentity claimsIdentity = null;        

            claimsIdentity = (IClaimsIdentity)claimsPrincipal.Identity;

            foreach (Claim claim in claimsIdentity.Claims)


                if (claim.ClaimType.ToLowerInvariant().EndsWith("/name"))

                {   user = claim.Value;                

                   //if user exist in the system then activate new session..

                    Session["user"] = user;



    However, the users tend to get logged out within 60 minutes even if they are actively using the application. Since we are not “refreshing” the token or doing  anything with it after the initial authentication, could that be the cause of the session ending abruptly? What can we do to prevent this from happening?

    Thank you.

    Monday, November 16, 2015 4:31 PM


All replies

  • IIRC, that's the default for the RP token lifetime.

    You can change it with:

    Set-ADFSRelyingPartyTrust -Targetname "xxx" -TokenLifetime yyy

    Wednesday, November 18, 2015 11:41 PM
  • Hi, thanks for providing the command. It does increase the TokenLifetime. If I set it as 600 then it keeps the session active for that amount of time. I haven't changed the Web SSO lifetime which is 480 minutes. I am assuming that the session will end after the time period is completed even if a user is still active. Is there a way this can be prevented? i.e. if we do not want the session to end abruptly when the TokenLifetime period is reached even if its 10 hours.

    Thank you.
    Monday, November 23, 2015 3:30 PM
  • Use sliding sessions : refer Sliding Sessions for WIF 4.5.

    • Marked as answer by sferro Friday, June 3, 2016 6:03 AM
    Monday, November 23, 2015 5:54 PM
  • Thank you. The reference link you provided helped.
    Tuesday, December 22, 2015 6:33 AM