会话超时未在Azure中的Redis缓存会话状态提供滑动 [英] Session timeout is not sliding in Azure Redis Cache Session State Provider

查看:230
本文介绍了会话超时未在Azure中的Redis缓存会话状态提供滑动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过多发情况下,向外扩展的Web应用程序是Azure云的最大优势之一。要acheive多发我们的,我们正在实施的Azure Redis的缓存webrole云应用程序的虚拟机的支持。我们正在使用RedisSessionStateProvider提供商维护会话状态。 web.config文件中以下是会话管理的配置设置。

Scaling out web application through mutiple instances is one of biggest advantages of azure cloud. To acheive mutiple VMs support for our webrole cloud application we are implementing Azure Redis Cache. We are using RedisSessionStateProvider provider for maintaining session state. Following are the configuration settings for session management within web.config file.

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

我们的问题是,会话超时未与用户的回传扩展,假设我们的用户登录到应用程序在10:00那么他的会话数据将在绝对上午10:20到期。如果在10:15 AM用户回发那么会话应该在上午10:35到期,但这是不会发生这是截止于10:20 AM绝对的。

Our problem is that session timeout is not extending with the user's postback, suppose our user logs into the application at 10:00 AM then his session data will expire at absolute 10:20 AM. If user postbacks at 10:15 AM then session should expire at 10:35 AM but this is not happening it is expiring on 10:20 AM absolute.

以下是在登录按钮的点击事件code

Following is the code at login button's click event

保护无效的button1_Click(对象发件人,EventArgs的发送)
        {

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");

    }

我想AP preciate如果可以让我知道需要做得到会话超时在滑模什么。
最好的问候,

I would appreciate if could let me know what needs to be done to get session timeout in sliding mode. Best Regards,

H.R亚达夫

推荐答案

感谢您报告了该问题。我们已经发布了上述报告的bug修复RedisSessionStateProvider的NuGet包的新版本。

Thanks you for reporting the issue. We have released a new version of RedisSessionStateProvider NuGet package that fixes above reported bug.

https://www.nuget.org/packages/Microsoft。 Web.RedisSessionStateProvider / 1.5.0

编辑:
我们发现这一个多的问题。 ASP.NET并不要求ResetItemTimeout对AJAX请求,并成为其他会话状态的方法,会话超时滑动的责任。我们已经修正了这个错误,并发布了新的NuGet包:的https:// WWW .nu​​get.org /包/ Microsoft.Web.RedisSessionStateProvider / 1.6.5

让我们知道,这是解决您的问题或没有?

Let us know is this resolves your issue or not?

这篇关于会话超时未在Azure中的Redis缓存会话状态提供滑动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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