Blog Post not visible in BlogEngine

These days I’m using .NET Open Sources software at my best level. You won’t believe I’ve used BlogEngine implementations for 3 clients this month. Not exact the BlogEngine but its implementations in some other implementation.

Well, the issue I’m going to resolve is basically time-zone issue, due to this newly created post will not be visible on home page. When using a hosting provider which is outside of your time-zone, say 4 hours, your posts don't show up for that amount of time in local time-zone.  In the settings, there is a time-zone offset you can set, but unfortunately this is rather buggy.

Well, if you have BlogEngine code you can fix it yourself, follow the steps:

Step 1. Open Post.cs file from BlogEngine.Core project

Step 2. Find following code
else if (this.IsPublished && this.DateCreated <= DateTime.Now.AddHours(BlogSettings.Instance.Timezone))

Step 3. Replace above code by this
else if (this.IsPublished)

Step 4. Find following code
//return (this.IsPublished && this.DateCreated <= DateTime.Now.AddHours(BlogSettings.Instance.Timezone)) &&
//        this.IsDeleted == false;

Step 5. Replace above code by this
return this.IsPublished && this.IsDeleted == false;

Now, Build the solution and publish it. Now post will be visible just after publishing, no any time-zone based delay.

This is workaround, because any post you post 9 AM IST will be visible to everyone who is even 4 hours behind.

Hope this helps.

Comments

Post a Comment

Popular posts from this blog

Migrating database from ASP.NET Identity to ASP.NET Core Identity

Customize User's Profile in ASP.NET Identity System

Lambda two tables and three tables inner join code samples