”Don’t focus on having a great blog. Focus on
producing a blog that’s great for your readers.”- Brian Clark
 
 

BlogEngine.NET Cache Delays Add/Edit Posts

02 December 2013

If you are using BlogEngine.NET on your blog site, you might have experienced this similar situation when you add a new entry or edit an old post, that it doesn't show the update right away. Instead, it displays the updated posts after a few hours. This happens even after you clear the browser cache or change to different browsers.

This is due to the fact that BlogEngine.NET stores data in server cache to improve page load and website performance so you can get instance response when you access the website. This is an awesome technique, but we can find a little workaround so we can clear the cache everytime we add/edit blog post.

The following code will modify the Date Modified value of the web.config file, which will clear out everything cached in memory.

string ConfigPath = HttpContext.Current.Request.PhysicalApplicationPath + "\\web.config";
System.IO.File.SetLastWriteTimeUtc(ConfigPath, DateTime.UtcNow);

About Site by Tommy

Freelance web design and developer in Jakarta and Microsoft Certified Professional with five years of experience in web design and development, application development, database system, Search Engine Optimization (SEO), graphic design, logo design, business cards, corporate letterhead, posters/banners, brochures and flyers, social media marketing, and email marketing/campaign.

 
Project Highlight
 
What Client Says
 
I’ve Got You Covered
  • Website Design
  • Application Development
  • Database System
  • Search Engine Optimization
  • Web Hosting
  • Graphic Design
  • Logo Design
  • Business Cards
  • Corporate Letterhead
  • Posters/Banners
  • Brochures and Flyers
  • Event Invitations
  • Promotional Products
  • Social Media Marketing
  • E-mail Marketing/Campaign
  • Event Marketing