Possible to use Cache object in library assembly

A

AC

Is it possible to use the System.Web.Caching.Cache object in a class library project (where there's no HttpContext)? I have web application, but want the cache to be managed by a library project (business layer).

-AC
 
N

Nicholas Paldino [.NET/C# MVP]

AC,

You can easily do this. You can get the HttpContext that the current
code is running in through the static Current property on the HttpContext
class. If running outside of ASP.NET, then it should return null.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Is it possible to use the System.Web.Caching.Cache object in a class library
project (where there's no HttpContext)? I have web application, but want
the cache to be managed by a library project (business layer).

-AC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top