In previously we already discuss the “required field validation ”, “Range validator ” & “Compared field validator” with a full description with practical solution checked it out now I show you Caching in ASP.Net. so open your visual studio For more Caching in ASP.Net:- Caching in ASP.Net


Caching in ASP.NET

is a technique of storing frequently used data/information
in memory, so that, when the same data/information is needed next
time, it could be directly retrieved from the memory instead of
being generated by the application.

So is extremely important for performance boosting in
ASP.Net, as the pages and controls are dynamically generated here.
It is especially important for data-related transactions, as these are
expensive in terms of response time.

And places frequently used data in quickly accessed media like
the random access memory of the computer. The ASP.Net runtime
includes a key-value map of CLR objects called cache. This lives
with the application and is available via the HttpContext and
System.Web. UI.Page. and As well as

1.) Page Output

So Page Output caches an entire page. It provides
you to cache the entire rendered contents of a page in memory.
The next time that any user requests the same page, the page is
retrieved from the cache.

Rendering a page may involve some complex processes like,
database access, rendering complex controls etc. Output
caching allows bypassing the round trips to server by caching
data in memory. Even the whole page could be cached.

The Output Cache directive is responsible of output caching. It
enables output caching and provides certain control over its
behavior. and As well as

2.) Partial Page

Partial-Page Output Caching, or page fragment caching, allows
specific regions of pages to be cached.

ASP.NET provides a way to take advantage of this powerful
technique, requiring that the part(s) of the page you wish to have
cached appear in a User Control.

One way to specify that the contents of a User Control should be
cached is to supply an Output Cache directive at the top of the
User Control. That’s it! The content inside the User Control will
now be cached for the specified period, while the ASP.NET Web
page that contains the User Control will continue to serve dynamic

Note that for this you should not place an Output Cache directive
in the ASP.NET Web page that contains the User Control – just
inside of the User Control. and As well as

3.) Data Caching in

The main aspect of data caching is caching the data
source controls. We have already discussed that the data
source controls represent data in a data source, like a database
or an XML file.

These controls derive from the abstract class Data Source
Control and have the following inherited properties for
implementing caching:

CacheDuration – It sets the number of seconds for which the data
source will cache data.

So CacheExpirationPolicy – It defines the cache behavior when the data
in cache has expired.

CacheKeyDependency – It identifies a key for the controls that
auto-expires the content of its cache when removed.

Enable- It specifies whether or not to cache the data. and As well as

4.) Object Caching

So Object caching provides more flexibility than other cache
techniques. You can use object caching to place any object
in the cache. The object can be of any type – a data type, a
web control, a class, a dataset object, etc.

So The item is added to the cache simply by assigning a new
key name, shown as follows Like:

Cache[“key”] = item

ASP.NET also provides the Insert() method for inserting an
object into the cache. This method has four overloaded
versions. Let us see them: and As well as

And for more learning click here:-

As well as comment and share with your friends

By Sharma

Leave a Reply

Your email address will not be published. Required fields are marked *