如何从其他Web配置文件增加或减少会话超时 [英] How to increase or decrease session timeout from other then web config file

查看:76
本文介绍了如何从其他Web配置文件增加或减少会话超时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从其他Web配置文件增加或减少会话超时。在我的schenario中,我必须为所有用户修复会话时间,但对于某些特定用户,我需要从代码手动减少。



我是什么尝试过:



在我的schenario中,我必须为所有用户修复会话超时,但对于某些特定用户,我需要手动减少代码。



我尝试使用以下代码设置会话超时但无法设置。



FormsAuthenticationConfiguration obj = new FormsAuthenticationConfiguration();

obj.Timeout = TimeSpan.FromMinutes(1);

How to increase or decrease session timeout from other then web config file. As in my schenario, I have to fix the session time out for all user but for some specific user i need to decrease manually from code.

What I have tried:

As in my schenario, I have to fix the session time out for all user but for some specific user i need to decrease manually from code.

I tried to set the session timeout using below code but not able to set.

FormsAuthenticationConfiguration obj = new FormsAuthenticationConfiguration();
obj.Timeout = TimeSpan.FromMinutes(1);

推荐答案

当特定用户登录时,设置 Session.Timeout property [ ^ ]到wh atever你想要它:

When the specific user logs in, set the Session.Timeout property[^] to whatever you want it to be:
Session.Timeout = 1; // Minutes


这篇关于如何从其他Web配置文件增加或减少会话超时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆