RedisSessionProvider
RedisSessionProvider copied to clipboard
How to provide Password
Hi,
My current redis instance is password protected. In the obsolete 'GetRedisServerAddress' Method, we have privilege to add password for redis server.
Can you please provide code snippet how to add 'password' information using ConfigurationOptions.
This is what i've used. It didn't work.
Application["redisConfigurationOptions"] = new ConfigurationOptions
{
AllowAdmin = true,
Password = "Omg@123"
};
Application["redisConfigurationOptions"] = ConfigurationOptions.Parse("localhost:6379");
RedisConnectionConfig.GetSERedisServerConfig = (HttpContextBase context) =>
{
return new KeyValuePair<string, ConfigurationOptions>(
"redisConnection",
(ConfigurationOptions)Application["redisConfigurationOptions"]);
};
You are overwriting the value of Application ["redisConfigurationOptions"], so it does not work.
Try
Application["redisConfigurationOptions"] = ConfigurationOptions.Parse("localhost:6379,password=[YOUR_PASSWORD],allowAdmin=true");