Different session time out for different users

荒凉一梦 提交于 2019-12-04 07:23:41
Learning

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;
    }
}

You can call SetSessionTime() after user successfully logs in.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!