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 -

c# - Regex Problems, extracting data to groups -

silverlight - SL4 - TextTrimming in DataGridRowGroupHeader -