Friday, 10 February 2023

Different session time out for different users

 

Different session time out for different users

 

Setting Session.Timeout property by code will set the timeout on a per user basis.

You can manually set Session.Timeout = 20; or Session.Timeout = 180; based on the user type when they log in.

This code should work for you:

protected void SetSessionTime(string userType)
{
    if (UserType == "admin")
    {
        Session.Timeout = 180;
    }
    else
    {
        Session.Timeout = 20;
    }
}

 

No comments:

Post a Comment

Note: only a member of this blog may post a comment.

Blog Archive