leewang0 / RedisSessionProvider

Provides a drop-in class library that makes ASP.NET's System.Web Session object store its contents in a Redis server or servers.
Apache License 2.0
66 stars 42 forks source link

'System.Web.HttpApplicationState' does not contain a definition for 'redisConfigOpts' #10

Closed redwards510 closed 10 years ago

redwards510 commented 10 years ago

I followed the instructions exactly, adding in the web.config portion and the using statements. I'm getting an error on the code in Application_Start:

Application.redisConfigOpts = ConfigurationOptions.Parse("127.0.0.1:6379");

Error 3 'System.Web.HttpApplicationState' does not contain a definition for 'redisConfigOpts' and no extension method 'redisConfigOpts' accepting a first argument of type 'System.Web.HttpApplicationState' could be found (are you missing a using directive or an assembly reference?)

Am I doing something wrong?

redwards510 commented 10 years ago

Application.redisConfigOpts = ConfigurationOptions.Parse("{ip}:{port}");

should be

Application["redisConfigOpts"] = ConfigurationOptions.Parse("{ip}:{port}");

and the other reference to Application.redisConfigOpts should be:

(ConfigurationOptions)Application["redisConfigOpts"]);

leewang0 commented 10 years ago

Another option instead of using the Application[] dictionary is to add:

public ConfigurationOptions redisConfigOpts { get; set; }

To your Global.asax.cs class. I'll add that line to the readme, sorry about the confusion.

leewang0 commented 10 years ago

Readme.md has been updated.