BlogEngine modified to include Post view count

by Viper 27. January 2009 06:16

I have modified latest version of BlogEngine.Net to record number of times a post has been viewed and then display it on the post itself. I did the following things to make this change:

  • Add a new field Views in be_Posts table to record view count. You can use following SQL query to update the existing table in SQL database.
    
    update table [dbo].[be_Posts]
      Add [Views] [int] DEFAULT(0)
    
    
  • Updated code in DbBlogProvider.cs to include column in all CRUD operations.
  • Updated Post.cs to include new property Views and a method to increment view count and then update that post in database.
  • Updated Post.aspx.cs in web application to call Viewed method on Post to increment view count.
  • Finally added a small piece of code in PostView.ascx to display view count.

I have attached SVN patch file that has the changes to latest code available from codeplex.

BlogEngine_View.patch (5.79 kb)

Views: 3980

Tags:

ASP.Net | Blog Engine

Comments

7/15/2009 3:33:03 PM #

Harry Potter Movie

is this a custom theme by chance?

Harry Potter Movie United States

8/15/2009 12:25:18 AM #

Citizen Mens Eco Drive

Do you earn decent money from this blog or are you doing it just for fun?

Citizen Mens Eco Drive United States

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading



Powered by BlogEngine.NET 1.5.1.7
Theme by Naveen Kohli