Caching in ASP.net -


i m having webservice. in m using caching.

i have wrote following code store datatable in cache.

using system.web.caching;  cache.insert("dt", dt, null, datetime.now.addhours(1), timespan.zero, system.web.caching.cacheitempriority.default, null); 

it give me error "an object reference required non static field.

how can remove error

you're trying use cache class static one.

if want use current cache class instance http context during request, should doing like:

httpcontext.current.cache.insert("dt", dt, null, datetime.now.addhours(1), timespan.zero, system.web.caching.cacheitempriority.default, null); 

Comments

Popular posts from this blog

forms - Secure PHP File Upload Script -

PHP: Exploding array elements -

reflection - How to use FxCop CustomDictionary.xml from the project localization? -