Posts Add/Edit does not update the blog

Topics: ASP.NET 2.0
Dec 31, 2010 at 11:34 AM
Edited Dec 31, 2010 at 12:37 PM

when i add new entry or edit any posts topic, its not showing the updated post on home page. Instead it display the updated posts after approx 1 hour.

i would appreciate any help

BlogEngine 1.6


Server: IIS

Database: SQL Server 2005



Jan 3, 2011 at 5:54 AM

plz reply to my above question, its serious issue with BlogEngine.NET 1.6 which i am using on my server


Jan 3, 2011 at 6:52 AM

Is your site in a cloud computing environment, or a server with load balancers, or a web farm or something along these lines?

There's a known issue where when in this type of environment, changes to data (posts, settings, etc) may not visibly be seen for a while.

Jan 3, 2011 at 9:00 AM

no, its on IIS v6 server, and SQL Server 2005 DB,

there is no such thing installed on server, its basically using for testing purpose

the problem is when a posts is edited or new entry is made, its shows on home page at first, but on refresh it shows old posts that were edited or deleted,

is there any thing wrong with cache !!!  

Jan 3, 2011 at 9:18 PM

The only time I've seen the behavior you're describing is when there are multiple servers handling the website -- like what you would have in a web farm, for example.

All the posts are cached in memory.  If there are multiple servers handling the website, then when you add/edit/delete a post on one server, that server's cache is updated, but the other servers are still using the old cache since they are not aware of the change in data.  If the application pool recycles, or if the site is dormant for a while (i.e. it's not being used), then the cache clears out, and the latest data is re-read from the DB.

The symptoms your describe sounds like it fits this scenario.

Are you updating the posts thru the control panel on the Add Entry page ... or are you adding the posts via WLW?  If you're using WLW, I would check and make sure the WLW Account is pointing to the correct website location.

Jan 4, 2011 at 7:43 AM

Thanx Ben

i have tried ur new stable release of BlogEngine.Net 2.0

so far its working fine, but sometimes if again shows some previous posts which were deleted, i think u have a flag in sql db for deleted items

 but my question is. is there any way to remove the ASP application cache on application exit ?

and yes i am updating posts thru control panel on the Add Entry page and i have only single server which handles the requests

Jan 5, 2011 at 3:49 AM

Does anybody know how to remove the ASP application cache on application exit ?

i want to remove the cache for BlogEngine.NET

Jan 5, 2011 at 6:52 AM

You can clear the cache by modifying the web.config file.  The code below 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);
Jan 5, 2011 at 10:09 AM

thanx a lot,

this finally works

but every page now takes a while to load, i think its ok

Jan 5, 2011 at 11:32 AM

one issue that i am still facing with posts is

sometimes while writing new posts, when i hit save post i got following error

any help

Server Error in '/' Application.

The resource cannot be found.

Description: HTTP 404. The resource you are looking for (or one of its dependencies) could have been removed, had its name changed, or is temporarily unavailable.  Please review the following URL and make sure that it is spelled correctly.

Requested URL: /post/2011/01/04/1234.aspx

Version Information: Microsoft .NET Framework Version:2.0.50727.3615; ASP.NET Version:2.0.50727.3618


Jan 5, 2011 at 6:31 PM

Did that error start happening when you added the code to update the web.config file timestamp?  Or did it exist from before?

The reason for the delay when you update the web.config timestamp is because BE is re-loading all the data.

When you get this 404 error, if you refresh your browser (F5), do you then see the post?  Just wondering if maybe while the data is re-loading the post isn't immediately available.

Jan 6, 2011 at 3:59 AM

that error exists before update the web.config file stamp. infact the moment i install the BlogEngine.NET 2.0 that issue occurs

when the error occurs for a particular post, if i refresh the page it still stuck on that error page. but when you go to home page by reopen the blog, that post is visible. and when you click on that new post then it displays the new page for that post. i mean the database entry for that post was made the moment i save the post, but it throws error,


anyway i had just avoided that error 404 by handling custom errors in IIS and redirect it to home page.

still thats no solution. that error occurs not always but on any random post save event. don't know why


Jan 8, 2011 at 4:26 PM

Mr ben. i would appreciate if you kindly give me any appropriate solution to my last above problem, bcz its happening to my live site

Many Thanks

Jan 9, 2011 at 5:33 AM

I'm not sure exactly.  I think this problem you have now is related to the original problem you had where new posts wouldn't show up for an hour.  In this case, the reason the 404 is occurring is (I think) because the web server does not think the post exists.  After some time has gone by, it realizes the post exists.

Where did you add the code to update the web.config file's timestamp?  Did you add it on the page where you compose/save the post?  Or did you add it on the homepage somewhere?  I think that once you update the web.config file's timestamp, the latest data is read in from the data store (DB or App_Data) and you will not get the 404 error.  So I think you just need to add that code somewhere so it fires right after you create a new post.  Or create a new button in the control panel that you can click that will update the web.config file timestamp.  You can click the button whenever you create a new post.

Obviously these suggestions are not perfect, but I don't know the reason for the data not showing up right away.  As I mentioned before, the only time I've seen this is in situations where there is load balancing going on, or a cloud computing environment.  I've not heard of this problem happening in an environment where there is just a single web server handling the site.  You are the first person I can think of where this is happening and there is not multiple servers handling the site.  My gut feeling is that the place where the site is hosted has some type of load balancing or cloud computing environment setup .... or at least something is configured oddly.

Jan 9, 2011 at 4:17 PM

Sorry Mr ben, i forgot to tel you that the code to update the web.config file's timestamp was written at Site's master page on load() event from themes files.

well i believe there is separate Master page for Admin section. and the write new post page also uses that admin's master page. and the code to update the web.config file's timestamp was not written on that admin's master page on load.


again sorry for not telling you this little info. i think you caught my problem very accurately. this was all cache update issue

thanks for you guidance.

Jan 10, 2011 at 9:34 AM
Edited Jan 10, 2011 at 9:38 AM

I'm the second person and I have a similar problem occurs

is it possible to write in detail to insert the code?

Jan 10, 2011 at 10:04 AM

kindly brief me ur problem specifically.

if you are facing the same above problem then as the topic says, then you need to remove the cache from you application on load event.

Jan 10, 2011 at 10:13 AM
Edited Jan 10, 2011 at 10:32 AM

Constantly showing old pages instead of new, If you update the web.config then the problem disappears, but before the first change of records or the post, and generally anything

where to specifically insert this code?

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


Jan 10, 2011 at 10:32 AM

read the above messages, hopefully you'll find the solution

Jan 10, 2011 at 10:43 AM

I read them.  but I do not understand how and where to insert this code by hand.

If you can please write an example of how to do it.

Jan 10, 2011 at 10:44 AM

try to insert these lines at Site's master page.cs on page_load() event from themes files and then check if it fixes ur problem

Jan 10, 2011 at 11:07 AM
Edited Jan 10, 2011 at 11:21 AM


using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using BlogEngine.Core;

public partial class StandardSite : System.Web.UI.MasterPage
  protected void Page_Load(object sender, EventArgs e)
		string ConfigPath = HttpContext.Current.Request.PhysicalApplicationPath + "\\web.config";
		System.IO.File.SetLastWriteTimeUtc(ConfigPath, DateTime.UtcNow);

		if (Security.IsAuthenticated)
            aUser.InnerText = "Welcome " + Page.User.Identity.Name + "!";
			aLogin.InnerText = Resources.labels.logoff;
			aLogin.HRef = Utils.RelativeWebRoot + "Account/login.aspx?logoff";
			aLogin.HRef = Utils.RelativeWebRoot + "Account/login.aspx";
			aLogin.InnerText = Resources.labels.login;

Thank you!  works , but every page now takes a while to load


Jan 10, 2011 at 11:35 AM

any time :)

thats what Mr Bean Amada told me. i also have same page load delaying issue, but i think its better not to cache pages for faster responding