转载 mvc中 将session保存到redis中 实现共享session

Posted hello world

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了转载 mvc中 将session保存到redis中 实现共享session相关的知识,希望对你有一定的参考价值。

1 <system.web>
 2     <authentication mode="None" />
 3     <compilation debug="true" targetFramework="4.5" />
 4     <httpRuntime targetFramework="4.5" />
 5     <sessionState mode="Custom" customProvider="MySessionStateStore">
 6       <providers>
 7         <!-- Either use ‘connectionString‘ and provide all parameters as string OR use ‘host‘,‘port‘,‘accessKey‘,‘ssl‘,‘connectionTimeoutInMilliseconds‘ and ‘operationTimeoutInMilliseconds‘. -->
 8         <!-- ‘throwOnError‘,‘retryTimeoutInMilliseconds‘,‘databaseId‘ and ‘applicationName‘ can be used with both options. -->
 9         <!--
10           <add name="MySessionStateStore" 
11             host = "127.0.0.1" [String]
12             port = "" [number]
13             accessKey = "" [String]
14             ssl = "false" [true|false]
15             throwOnError = "true" [true|false]
16             retryTimeoutInMilliseconds = "5000" [number]
17             databaseId = "0" [number]
18             applicationName = "" [String]
19             connectionTimeoutInMilliseconds = "5000" [number]
20             operationTimeoutInMilliseconds = "1000" [number]
21             connectionString = "<Valid StackExchange.Redis connection string>" [String]
22             loggingClassName = "<Assembly qualified class name that contains logging method specified below>" [String]
23             loggingMethodName = "<Logging method should be defined in loggingClass. It should be public, static, does not take any parameters and should have a return type of System.IO.TextWriter.>" [String]
24           />
25         -->
26         <add name="MySessionStateStore" type="Microsoft.Web.Redis.RedisSessionStateProvider" host="192.168.5.102" port = "6379" accessKey="" ssl="false" />
27       </providers>
28     </sessionState>
29   </system.web>

以上是关于转载 mvc中 将session保存到redis中 实现共享session的主要内容,如果未能解决你的问题,请参考以下文章

PHP将 SESSION 数据保存到 Redis

如何配置resin4将session保存到redis

laravel框架中 session保存到Redis中

MVC中如何在页面中一直能将用户ID保存在各个页面中,不用每次都查一遍?

Spring-SESSION+Redis 实现Session共享

php session 保存到redis 实现session的共享