我需要在servlet的会话上创建一个倒计时,以便在X分钟到期时触发事件...
那么,有一种方法可以知道完成会话还剩多少秒?
经典ASP在哪里存储会话超时值?我已经看过代码,并且这个经典的ASP网站未使用Global.asa(因此没有“ Session_OnStart”)或Session.timeout = x。该网站托管在IIS 7上。在此网站的IIS上的“功能”视图中,双击“ ASP”->“会话属性”->“启用会话”设置为“ True”,并将“超时”值设置为20。问题是:尽管会话超时设置为20分钟。在IIS上,5分钟后超时。还有其他方法/地方可以修改此经典ASP网站的会话超时值吗?
有人可以帮我吗?
编辑:我查看了应用程序池的设置。空闲超时为20分钟。并将“回收->常规时间间隔”设置为1740。
在我的一个 Web 应用程序中,我需要在 5 分钟内会话超时时弹出警报。用户可以选择继续延长会话或立即注销。
在 Web.config 中将会话超时设置为 30 分钟:
<sessionState mode="InProc" timeout="30">
Run Code Online (Sandbox Code Playgroud)
由于 ASP.NET MVC 没有提供检查剩余会话超时的方法,我提出了如下解决方案:
在 Global.asax 中,它将当前会话的上次访问时间作为会话变量进行跟踪。如果传入请求不是只读会话状态(见下文),则上次访问时间会话变量将更新为当前时间。否则,会话变量的值将设置为当前时间。
protected void Application_AcquireRequestState(object sender, EventArgs e)
{
var context = HttpContext.Current;
if (context != null && context.Session != null && !context.Session.IsReadOnly)
{
context.Session["_LastAccessTime"] = DateTime.Now;
}
}
Run Code Online (Sandbox Code Playgroud)
在我的会话控制器中,我将会话状态行为设置为只读。对此控制器的请求既不会重置会话,也不会刷新我的上次访问时间会话变量。
[SessionState(SessionStateBehavior.ReadOnly)]
public class SessionController : BaseController
{
[AjaxOnly]
public ActionResult GetRemainingSessionTimeout()
{
if (!Request.IsAjaxRequest())
{
return Content("Not an Ajax call.");
}
var remainingSessionTimeout = 0;
if (Session["_LastAccessTime"] != null)
{ …Run Code Online (Sandbox Code Playgroud) 我正在使用 ASP.NET Core 的 ASP.NET Zero 版本 7、MVC 和 jQuery 项目。
我正在尝试设置会话超时/到期时间,以便在应用程序空闲一段时间后自动从应用程序注销。有人可以告诉我该怎么做吗?
在 ASP.NET Zero 版本 8 中,他们在用户管理设置中提供此配置。
session-timeout session-cookies asp.net-core-mvc asp.net-core aspnetboilerplate
过期会话和无效会话之间有什么区别?
而且,如何使会话在java中过期?
请帮我.提前致谢.
我发现了一些类似的问题,但没有人给我我真正需要的东西.
这是事情,我已将此添加到我web.config处理用户会话到期:
<sessionState mode="InProc" timeout="1" />
Run Code Online (Sandbox Code Playgroud)
1分钟后,会引发Session_End事件Global.asax:
Sub Session_End(ByVal sender As Object, ByVal e As EventArgs)
Response.Redirect("Login.aspx")
End Sub
Run Code Online (Sandbox Code Playgroud)
这不起作用,因为:
Response is not available in this context.
Run Code Online (Sandbox Code Playgroud)
(顺便说一句,这个问题得到了一个很好的说明,这是好的,它得到了回报).
我不想要任何幻想.我只想要一种简单的方法,在会话时间到期时将用户重定向到登录页面.就这样.
谢谢.
我看到ZF2会话和超时的一些奇怪和令人沮丧的行为.
这是我用来设置会话的代码:
$sessionConfig = new \Zend\Session\Config\StandardConfig();
$sessionConfig->setOptions(array(
'cache_expire' => 525949,
'cookie_domain' => 'mydomain.com',
'cookie_lifetime' => 31536000,
'cookie_path' => '/',
'cookie_secure' => TRUE,
'gc_maxlifetime' => 31536000,
'name' => 'mydomain',
'remember_me_seconds' => 31536000,
'use_cookies' => TRUE,
));
$sessionManager = new \Zend\Session\SessionManager($sessionConfig);
$sessionManager->rememberMe(31536000);
$sessionManager->setSaveHandler(new \Zend\Session\SaveHandler\MongoDB($mongo, $options);
$session = new \Zend\Session\Container('MY_SESSION', $sessionManager);
Run Code Online (Sandbox Code Playgroud)
当我执行此代码时,cookie将被创建,但过期是会话结束.
如果我改变这样的代码:
$sessionManager = new \Zend\Session\SessionManager();
$sessionManager->rememberMe(31536000);
$sessionManager->setConfig($sessionConfig);
$session = new \Zend\Session\Container('MY_SESSION', $sessionManager);
Run Code Online (Sandbox Code Playgroud)
cookie被创建,到期时间为一年.
但是,即使cookie仍然存在,会话仍会在30分钟左右后到期.
我想要的是cookie和会话持续一年.我如何在ZF2中实现这一目标?
我正在使用Windows身份验证来帮助阻止访问网站.此网站不在我的网络中托管,这意味着我第一次尝试访问它时,我必须输入该服务器的Windows凭据.这一切都很棒.
我的问题在于超时.如果我使用匿名身份验证和表单身份验证,IIS似乎正确使用会话超时/表单超时值20分钟.
但是,当我使用Windows身份验证时,它似乎会超过20分钟.我还没有找到一种方法来增加Windows身份验证超时值.我需要它大约20分钟.
我的应用程序池设置被设置为永远不会回收应用程序池,因此我知道它不会因应用程序池刷新而超时.
这是一个ASP.NET MVC 4网站,这是一个问题.
有关如何在IIS7中增加Windows身份验证超时的任何想法?
authentication session iis-7 windows-authentication session-timeout
通过多个实例扩展Web应用程序是azure cloud的最大优势之一.为了实现对我们的Web角色云应用程序的多个VM支持,我们正在实施Azure Redis缓存.我们使用RedisSessionStateProvider提供程序来维护会话状态.以下是web.config文件中会话管理的配置设置.
<authentication mode="Forms">
<forms loginUrl="~/Login" slidingExpiration="true" timeout="20" defaultUrl="~/Default" />
</authentication>
<sessionState timeout="20" mode="Custom" customProvider="MySessionStateStore">
<providers>
<add name="MySessionStateStore" type="Microsoft.Web.Redis.RedisSessionStateProvider"
host = "dummy.redis.cache.windows.net"
port = "6380"
accessKey = "dummysecretkey"
ssl = "true"
throwOnError = "true"
retryTimeoutInMilliseconds = "5000"
databaseId = "0"
applicationName = ""
connectionTimeoutInMilliseconds = "5000"
operationTimeoutInMilliseconds = "1000"
connectionString = ""/>
</providers>
Run Code Online (Sandbox Code Playgroud)
我们的问题是会话超时没有随着用户的回发而延长,假设我们的用户在上午10:00登录应用程序,那么他的会话数据将在绝对时间上午10:20到期.如果用户在上午10:15回发,那么会话应该在上午10:35到期,但这不会发生,它将在10:20 AM绝对到期.
以下是登录按钮的点击事件中的代码
protected void Button1_Click(object sender, EventArgs e)
{
FormsAuthentication.SetAuthCookie(TextBox1.Text.Trim(), true);
ConnectionMultiplexer connection = ConnectionMultiplexer.Connec("dummy.redis.cache.windows.net,ssl=true,password=dummysecretkey");
IDatabase cache = connection.GetDatabase();
Session["UserName"] = TextBox1.Text;
Response.Redirect("Default.aspx");
}
Run Code Online (Sandbox Code Playgroud)
如果能让我知道在滑动模式下获得会话超时需要做什么,我将不胜感激.最好的祝福, …
我们正在使用Kafka高级消费者,并且能够成功使用消息,但是Zookeeper连接仍在过期并重新建立。
我想知道为什么没有心跳使连接保持活动:
Kafka Consumer Logs
====================
[localhost-startStop-1-SendThread(10.41.105.23:2181)] [ClientCnxn$SendThread] [line : 1096 ] - Client session timed out, have not heard from server in 2666ms for sessionid 0x153175bd3860159, closing socket connection and attempting reconnect
2016-03-08 18:00:06,750 INFO [localhost-startStop-1-SendThread(10.41.105.23:2181)] [ClientCnxn$SendThread] [line : 975 ] - Opening socket connection to server 10.41.105.23/10.41.105.23:2181. Will not attempt to authenticate using SASL (unknown error)
2016-03-08 18:00:06,823 INFO [localhost-startStop-1-SendThread(10.41.105.23:2181)] [ClientCnxn$SendThread] [line : 852 ] - Socket connection established to 10.41.105.23/10.41.105.23:2181, initiating session
2016-03-08 18:00:06,892 INFO [localhost-startStop-1-SendThread(10.41.105.23:2181)] [ClientCnxn$SendThread] …Run Code Online (Sandbox Code Playgroud) session-timeout apache-kafka kafka-consumer-api apache-zookeeper
session-timeout ×10
session ×3
asp.net ×2
iis-7 ×2
java ×2
.net ×1
ajax ×1
apache-kafka ×1
asp-classic ×1
asp.net-core ×1
azure ×1
jsp ×1
php ×1
redis ×1
servlets ×1
vb.net ×1