更改会议的变量超时的asp.net mvc的默认值 [英] Changing the default value of session's variable timeout in asp.net mvc

查看:247
本文介绍了更改会议的变量超时的asp.net mvc的默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Asp.net MVC应用程序与剃刀观点发动机,其中我用一个变量会话['用户'] :当应用程序的用户登录会话['用户'] =登录,并在注销时此变量作为值

现在的问题是,有一个短超时和会话变量过期:如果我什么都不做在一分钟内的日志后,在应用程序会话['用户'] = NULL 自动

所以,我如何设置超时的会话变量无限,直到被程序改变了吗?有什么建议?

解决方案
  

所以,我如何设置超时的会话变量无限,直到被程序改变了吗?有什么建议?

您不能设置暂停的价值是无限的。

您可以使用超时增加超时值以分钟为 的sessionState 元素中的网络属性的.config 的。


会话状态设置

在默认情况下,ASP.NET使用Cookie来标识哪些请求属于特定的会话。   如果Cookie不可用,会话可以通过添加会话标识符到URL进行跟踪。   要禁用cookie,设置的sessionState无cookie =真。

 <的sessionState模式=StateServer的无Cookie =假超时=120/>
 


看看这个会话超时

I have an Asp.net Mvc application with razor views engine , in which i used a variable Session['user'] : when an user log on the application Session['user'] = login and in the logout this variable takes as value Null.

The problem is that there is a short timeout and the session variable expires : if i do nothing in one minute after log on the application Session['user'] =null automatically.

So how can i set the timeout of the session's variable unlimited until it is changed by program?Any suggestions?

解决方案

So how can i set the timeout of the session's variable unlimited until it is changed by program?Any suggestions?

You can't set timeout value to unlimited.

You can increase the time out value in minutes using the timeout attribute of sessionState element in web.config.


SESSION STATE SETTINGS

By default ASP.NET uses cookies to identify which requests belong to a particular session. If cookies are not available, a session can be tracked by adding a session identifier to the URL. To disable cookies, set sessionState cookieless="true".

<sessionState mode="StateServer" cookieless="false" timeout="120"/>


Check out this Session-Time out

这篇关于更改会议的变量超时的asp.net mvc的默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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