从应用程序内改变的Web.Config SessionTimeout值 [英] Altering Web.Config SessionTimeout value from within application

查看:348
本文介绍了从应用程序内改变的Web.Config SessionTimeout值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出一种方法来动态地改变会话超时,我的客户已要求这是他们可以很容易改变一个值(就像它是一个数据库事务)。这里是我试图改变价值的删减版本:

I am trying to work out a way to alter the session timeout dynamically, as my customer has requested that this be a value they can easily change (as though it were a database transaction). Here is a truncated version of the value I am trying to change:

<appSettings>
   <add key="SessionTimeout" value="20"/>
</appsettings>

我用C#的工作/。NET 3.5,这一切。

I'm working with C#/.Net 3.5 with all of this.

有关记录,我知道,改变的web.config文件将导致应用程序重新启动。我所去的是给程序管理员改变动态超时的能力。如果,例如,他们正在要求人们填写的形式之一是服用时间超过20分钟,他们需要撞击时间长达一个半小时,或者如果他们需要缩短一些其他的原因。因为我们希望保持用户(包括管理员)从code文件,目标是创造这个作为该网站的后台管理页面的一部分。

For the record, I am aware that altering the web.config file will cause a restart of the application. What I am going for is to give the administrator of the program the ability to alter the timeout on the fly. If, for example, one of the forms they are requiring people to fill out is taking longer than 20 minutes, and they need to bump the time up to a half hour, or if they want it shortened for some other reason. Since we want to keep the users (including admins) out of the code files, the goal is to create this as part of the site's admin page.

问题是,我不知道如何做到这一点,或者如果它甚至有可能(更是一个好主意)。我已经给谷歌左右运行,并拿出什么。

The problem is, I have no idea how to do this, or if it's even possible (much less a good idea). I've given google the run around and come up with nothing.

时有没有办法做这些改变,甚至可能会动态改变的飞行超时(覆盖web.config文件中的内容)?

Is there a way to make these alterations, or even potentially to dynamically change the timeout on the fly (overriding the contents of the web.config)?

感谢您的帮助。

推荐答案

而不是试图改变web.config中,如何在运行时code更改查看Session.Timeout?

Instead of trying to change web.config, how about changing Session.Timeout in code at runtime ?

更多信息:

http://msdn.microsoft.com/en-us/library/system.web.sessionstate.httpsessionstate.timeout.aspx

这篇关于从应用程序内改变的Web.Config SessionTimeout值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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