You must Sign In to post a response.
  • Category: ASP.NET

    How to Implement Customized Caching technique to my WebPage which is Built in 2.0

    Hello ,

    I have developed one WebPage in 2.0 .

    This my webpage is embedded on other websites. So when ever other website get hit my page also get hit even though any one not interested to visit my page. This Causes load on my DB.

    So I want to Implement Customized Caching technique , so that I don't want to hit DB. Because content very rarely get change.

    which Customized Caching technique should I use ?

    Regards ,
    Jeevan Joshi
  • #763399
    Hello Jeevan Joshi,

    Types of caching in ASP.NET :
    -> Page level output caching
    -> User control level output caching (or fragment caching)
    -> Cache API

    Page level output caching simply keeps a copy of the HTML that was sent in response to a request in memory.

    Fragment caching mostly used when you are creating dynamic menu bars from database values, etc.

    Cache API is the most powerful web technique and easy way to boost performance of the website.

    In your case Cache API will be the useful for you. Because your content changes very rarely. You can use Cache API in this way :

    Cache.Insert("xmldata", myXMLFileData, new System.Web.Caching.CacheDependency(Server.MapPath("users.xml")));

    Just go through the below article for your reference on caching techniques :

    Hope this will be helpful for you.

    Nirav Lalan
    DNS Gold Member
    "Failure is the path of least persistence"

  • #763436
    Hi, Sorry to say that I have no idea regarding this, but after reading this discussion I got a little bit knowledge. I know about when I hosted my website on "". Thanks a lot for sharing your ideas and Continue discussion so that those who have no idea like me can get something.

  • #763439

    We have different caching techniques to improve the performance by reducing load on database.
    OutPut Cache:
    If you want to cache the entire page then use the out put cache directive.

    <%@ OutputCache Duration="60" VaryByParam= "None" %>

    Data Cache:
    If you think the content changes rarely then use the data cache with file based dependency.
    When ever your data file gets changed then the data cache will keep the updated page and serves it for the request.

    Cache["dataset"] = mydataset;
    DataSet ds = new DataSet();
    ds = (DataSet)Cache["dataset"];

    Cache.Insert("Conn",ConnectionStringsSection,new System.Web.Caching.CacheDependency(Server.MapPath("config.xml")));

    Sridhar Thota.
    Editor: DNS Forum.

Sign In to post your comments