Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have developed an web application and am trying to store an object in the cache. But, I'm getting an Error: The type initializer for 'Microsoft.ApplicationServer.Caching.DataCacheFactoryConfiguration' threw an exception.

My Code to Add:

public static void AddToCache(string cacheName, string keyName, string objName) {

try
{

DataCacheFactoryConfiguration factoryConfig = new DataCacheFactoryConfiguration();

DataCacheFactory mycacheFactory = new DataCacheFactory();
DataCache = mycacheFactory.GetCache(cacheName);

DataCache.Add(keyName, objName);
}

catch(Exception ex)
{
HttpContext.Current.Response.Write("Error: " + ex.Message);
}

}

Please help frnds.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900