I am trying to access the Cache in the Application_Start method of Global.asax. I am trying to accdess Context.Cache. When I run the code from visual studio it works just fine but when I run it on the server from IIS I get: Session state is not available in this context. I want to seed some values in the cache when the application starts. How can I get at the cache from Application_Start?
C# – Error accessing the Cache in the Application_Start method of Global.asax
asp.netcglobal-asaxiis
Related Topic
- C# – Collection was modified; enumeration operation may not execute
- C# – An ASP.NET setting has been detected that does not apply in Integrated managed pipeline mode
- Config Error: This configuration section cannot be used at this path
- C# – The Web Application Project […] is configured to use IIS. The Web server […] could not be found.
- C# – Error – Unable to access the IIS metabase
- Visual-studio – Unable to launch the IIS Express Web server
- Visual-studio – Visual Studio 2017 error: Unable to start program, An operation is not legal in the current state
Best Answer
Wow. I found the answer to this. Use the variable HttpRuntime.Cache instead of Context.Cache.