The new class MemoryCache in .Net 4.0 appears to act just like asp.net caching. My questions are:
Is MemoryCache equivalent to storing an object/value in for a user in Session Cache, but not in the code behind of an aspx page.
Can a value stored in MemoryCache, which exists on the server, be accessable to a web page event?
No, it is not equivalent. The ASP.NET Session object is per user key/value storage, whereas MemoryCache is an application level key/value storage (values are shared among all users).
In ASP.NET MVC there are usually no web page events but you can access values stored in MemoryCache everywhere within the application.
Basically, in an ASP.NET application, the new
MemoryCacheobject is just a wrapper for the oldHttpContext.Cacheobject (it stores values in the old Cache object).