ASP.NET MVC 4 - Blog engine based on Twitter Bootstrap

 
9/6/2013
.NET, ASP.NET, C#, MVC
57 Comments

It's time to update my blog engine which I published some time ago. The updated version is now based on ASP MVC 4 and uses Twitter Bootstrap 3 instead of a custom CSS file. In this post I will give a short overview over the things that were changed.

Features/Setup

The features of the blog engine are described in this post.
The setup of the blog engine is quite easy. The directory 'Setup' contains a readme explaining the necessary steps.

Changes

Twitter Bootstrap

Twitter Bootstrap 3 uses a mobile first approach, that means that you don't have to integrate bootstrap-responsive.css any more.
The default design now looks like this:

MVCBlog

Dependency Injection

SimpleInjector is now used instead of Unity as IoC container. Why? It is one of the fastest containers with a lot of useful features.

Commands/CommandHandler

I decided to use the command pattern for modifying data. This is especially useful for bigger applications, but since the overhead is not that big, I applied this approach from @dot_NET_Junkie.

Updates

20.02.2014: Migrated to MVC 5.

16.06.2019: Migrated to ASP.NET Core 2.2.

Source Code

The latest source code can be found on GitHub.

Feedly Feedly Tweet


Related posts


Comments


Tia

Tia

1/23/2022

That's an amazing job. Well done. There are a few incongruousness but it still be a well done blog engine


Mike

Mike

3/2/2020

Hi, JavaScript or JqueryScript written not taking effect. Please me help me out. working with : https://github.com/danielpalme/MVCBlog


Daniel

Daniel

2/22/2020

@Paul: Did you change the setting "sendMail" to "true"? If that's the case please try again. If anything goes wrong, you can have a look in the log file in directory "Logs" or you can debug if something goes wrong.


Paul

Paul

2/22/2020

Having provided the mailsettings creditals in the appsettings.jason, i am unable to confirm user's email address amongst others. I have tried numerous procedures which hasn't been working either, having been working on this issue for a week now, i am completely drained. Any help to resolve the issue will be highly appreciated and would also help to continue on my learning journing. I would like a confirmation of email address to be sent to user upon registration. I am using the .net core app : https://github.com/danielpalme/MVCBlog


Paul

Paul

2/2/2020

@Daniel Thanking you for taking time out to attend to my enquiry. I'm now successfully able to access my file, following your instruction. More power to your elbow.


Daniel

Daniel

1/31/2020

@Paul: Have a look at the CSP rules in Statup.cs: https://github.com/danielpalme/MVCBlog/blob/4245ab4a626c756a732ca4128230d9140e242250/src/MVCBlog.Web/Startup.cs#L151 You probably have to reconfigure some if the rules.


Paul

Paul

1/30/2020

Thanks a million for the unique piece of work shared with other people, to benefit from. I have spent a significant amount of time trying to fine-tune your application to my suitability, all efforts and time spent seemed to have proved abortive. I am trying to include a multi-media file in the app, but for some reasons unknown the file is prevented from loading. multi-media files (mp4, webm, ogg) included in the project can not be accessed through html tag or by specifying full path in the browsers. It displays the video player image in static form without the file content. Below is my html tag : <video width="350" height="400" controls loop > <source src="~/videos/Sample_01.mp4" type="video/mp4"> <source src="https://localhost:****/videos/MySample.mp4" type="video/mp4"> </video> and browsers path : https://localhost:****/videos/MySample.mp4 I am using the .net core app : https://github.com/danielpalme/MVCBlog Any help will be highly apprecaited. Thanks


Rajadurai Az

Rajadurai Az

9/25/2018
https://blog.rexer.in

Hi @Daniel I am just fork you repo and changed to my blog It's awesome man. https://github.com/RajaduraiAz/personalBlog this is my personal blog source forked from yours. Thanks


Shakir

Shakir

2/15/2018

Hi Daniel I have Add Some filed in BlogEntries in Sql Database.and same filed Changed BlogEntry.cs class through error like The model backing the 'DatabaseContext' context has changed since the database was created. Consider using Code First Migrations to update the database (http://go.microsoft.com/fwlink/?LinkId=238269). help me please


Daniel

Daniel

7/19/2017

@Ted: I don't have plans to update the blog engine or to add more features. If you like, you can create a fork and customize the project.


Ted Campbell

Ted Campbell

7/17/2017
http://iterDev.com

Hi Daniel, Your original Blog engine is a great accomplishment. My shop prefers the MVC approach and I hope we can contribute to your MVC version of the BlogEngine. To that end, do you have an implementation road map for making the current version of the MVC BlogEngine feature complete, or equivalent, with the ASP.NET version? The UI customization is of particular interest in my shop. I am asking so that, if I can convince my management, I can begin with an approach that is in line with your plan and does not distract. Both BlogEngines are great work. I would like to contribute. This is just my attempt to make a first contact and get your thoughts. Thanks very much and best wishes in your future work. Ted Campbell


mustafadeniz

mustafadeniz

7/16/2017

hey Bill i try your source code but i have some error , how to fix this t4MVC.ttl problem After i downloaded the project , I ran the T4MVC.tt generator. It has errors and then the solution example error : Severity Code Description Project File Line Suppression State Error Compiling transformation: Type 'GeneratedTextTransformation' already defines a member called 'Write' with the same parameter types MVCBlog.Website C:\Users\musti\Downloads\MVCBlog-master\src\MVCBlog.Website\T4MVC.tt.hooks.t4 1


Tushar Soni

Tushar Soni

6/13/2017
http://www.aspdotnetdevelopment.com

Yeah, It's possible to add new users using Registry editor. Superb option for web. Config file. Thanks for sharing!


javi

javi

3/6/2017

In order to use the generic commands<entity> and their handlers I needed to change the signature of the handlers to take two Type parameters (Tcommand and Tentity). Otherwise I couldn't instantiate these generic handlers: No implicit reference conversion from Command<T> to EntityBase... I noticed that you don't use these generic commands and opted for specific handlers like: 'AddOrUpdateBlogEntryCommandHandler' instead of AddOrUpdateCommandHandler<T>. Any thought on that?


Javi

Javi

11/15/2016

Any fast way to migrate sdf DB to a mdf?? Great project thx a lot!


Daniel

Daniel

10/3/2016

@Bill: There nothing special. You could add a ContactController, the corresponding models and views. Then you implement the required methods in the controller. Then you should update the code generated by T4MVC.tt (right click then select "Run custom code").


Bill Hamm

Bill Hamm

10/2/2016

Hello Daniel, Great work. I am having trouble understanding exactly how to add on to this project. I am getting errors when I add typical MVC models and views. Would you briefly explain the process on adding a Contact page?


James

James

5/13/2016

I just wanted to say thank you for this. I'm studying MVC and this code is robust enough to teach me some things and yet simple enough that I can run with it. I hooked it up to a SQL 2012 DB and it worked on the first try. I had absolutely no issues. Kind of shocked by that actually. Great work.


shashi

shashi

3/16/2016
https://www.shashinewblog.com

hello, i have not make any query or table in sql but all content of blog like create new blog or post comments all save and never gone after refresh, i have question that how can be possible or working on your blog? can you please give a brief on it?..thankss


wajid

wajid

1/17/2016

Hello sir how i get these files of blog.............Help me......


miguel

miguel

5/19/2015

muy super este articulo. gracias por compartir experiencia


Dew

Dew

5/10/2015

After extracted 'src' folder. I open it with VS 2013 also run. But occur some error on global.aspx and application can't work.


mehmet

mehmet

4/15/2015

i download your blog project but i dont find username and password


Naveed Akhtar

Naveed Akhtar

3/5/2015
http://www.lightnodes.com

Hi Daniel, I personally preferred SimpleInjector over any other, simply because it's fastest, as fast as having no IoC Container. But SimpleInjector is not very simple when you like to integrate Identity 2 for roles and membership. As Identity use poor man's Ioc throughout and mostly implemented using multiple constructor methods for Controllers etc. There are few people who overcome this by adding more code, which was getting too complicated for me and the whole purpose of SimpleInjector was to keep things simple and speedy, isn't it! While Unity is comparatively slow, but is very flexible. I spend almost half a day trying to support simpleInjector and then gave up later it took me less than an hour to make my website up and running again with Unity. Call it my incompetence, but personally I like to have very neat and less code in my projects, less code means less maintenance.


Daniel

Daniel

3/2/2015

@Naveed: You can of course use Unity instead of SimpleInjector. But I don't understand why Unity should work better as SimpleInjector. Can you explain?


Naveed Akhtar

Naveed Akhtar

3/2/2015
http://www.lightnodes.com

Hi Daniel, Thanks for the blog engine. I have been thinking to integrate a CMS into my website, silly me, figured out, you can't integrate one. They want you to integrate your website into the CMS. Which i can't afford at the moment. A quick question, I want to use Unity, as its easier with Identity 2. I was using SimpleInjector before setting up Identity. It was just very complicated to set it up with it. So, do you see any problem if I use Unity with your MVC4 / bootstrap implementation?


Ashish Ranjan

Ashish Ranjan

1/29/2015

Hi Denial, Awesome job man. Good work!! I downloaded your stuffs for learning purpose. So many things in your code are new. Give me guideline how can i improve my skills. Thank you from core of my heart. Thanks


Smith Cole

Smith Cole

1/17/2015

Thanks for this nice information. It is very nice and clear way to setup. It is a great post. It is a kind interesting to do so because of the integrating blog engine into an existing site. Last time I am hosting a web site that using myasp.net. I learn many more idea here.


Alan

Alan

1/13/2015

BTW, the problem was that somehow the ZIP package had all the carriage returns stripped out with only line feeds in. The first 8 bytes of the good t4hooks had a CR/LF EF BB BF 23 2B 0D 0A The first 8 bytes of the zipped t4hooks had only an LF EF BB BF 23 2B 0A 2F That probably messed up the TT parsing.


Alan

Alan

1/13/2015

Hi Daniel, Yeah, I downloaded the zip. Thanks for looking into it. I will try getting it directly from GitHub for the tt files then. BTW, your code excellent. Very clean. Thanks for sharing it!


Daniel

Daniel

1/12/2015

@Alan: Very strange issue. When I download the ZIP file, I get the same error. When I check out the files directly from Github, it seems to work.


Alan

Alan

1/12/2015

Great project! I have one issue though that I havent been able to resolve. After i downloaded the project , I ran the T4MVC.tt generator. It has errors and then the solution wont compile. Error 82 Compiling transformation: Invalid token 'this' in class, struct, or interface member declaration Error 83 Compiling transformation: Method must have a return type Error 84 Compiling transformation: Type expected


facupola

facupola

1/10/2015

thanks for all Daniel! it's an excellent project and it's works great! Very usefull and complete!!! Regards!


Rénald VENANT-VALERY

Rénald VENANT-VALERY

12/29/2014

Hello, many thanks for this blog engine. That's exactly what I was looking for. Simple, performant, minimalist, and very efficient.


Daniel

Daniel

11/21/2014

@Andrey: Yes, that's supported


Andrey

Andrey

11/21/2014

Hello! I see an RSS icon on the screenshot. Does your blog engine support rss feed generating? Thanks.


dave

dave

11/1/2014
http://www.davidyardy.com

Is there any code/mechanism to import existing blog content via a blogml.xml file?


Daniel

Daniel

10/30/2014

@Robert: The Github repository contains a solutions file. You should be able to build to solution. Be sure you have Nuget package restore enabled.


Robert

Robert

10/30/2014

Can you upload on Git the version which can be built out of box? The current one doesn't have solution file and doesn't build for me. Preferably changing it to web application project.


Daniel

Daniel

10/16/2014

@Nico: No credits required.


Nico

Nico

10/16/2014

Hello if using this blog must i provide any credits?


David

David

9/29/2014

Hello, Thank you very much for this project! Really great! I have one question. I am not familiar with Dependency Injection and I would want to remove SimpleInjector and no dependency injection at all. Any advise how can I remove the SimpleInjector and make the blog work without that? I know I have to remove the nuget and so on but what I have to change in the code so I will make it work without dependency injection? Thank you very much!


Daniel

Daniel

9/18/2014

@Rob: When you are editing a blog entry you can add and remove its tags. If you want to change an existing tag name, then you have to do this at database level. There in no specific UI for that.


Rob

Rob

9/17/2014

How do I change the Tags?


Daniel

Daniel

9/9/2014

@Alec: I have no plans for any modifications at this time. My spam protection works pretty well (hidden website field and time stamp) and stupid comments are very rare on my blog, I delete them right after receiving the corresponding email notification.


Alec

Alec

9/9/2014

Are you considering implementing comment moderation? That appears to be the only downfall of an otherwise great project.


Daniel

Daniel

9/3/2014

@Mein Name: There seems to be an issue with async child actions: http://stackoverflow.com/questions/13959251/async-and-await-in-mvc-4-controller https://aspnetwebstack.codeplex.com/workitem/601 I can't reproduce this on my machine, but fixing the problem is easy. Will apply the necessary changes soon.


Mein Name

Mein Name

9/2/2014

Any ideas how to deal with this run-time error? HttpServerUtility.Execute blocked while waiting for an asynchronous operation to complete. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: HttpServerUtility.Execute blocked while waiting for an asynchronous operation to complete. Source Error: Line 21: <div class="col-md-3"> Line 22: <h3>@Common.Tags</h3> Line 23: @{Html.RenderAction(MVC.Blog.Tags());} Line 24: Line 25: <h3>@Common.PopularPosts</h3> Source File: c:\...\MVCBlog.Website\Views\Shared\Sidebar.Layout.cshtml Line: 23


teksonit

teksonit

7/31/2014
http://www.teksonit.com

Great Information admin thanks For Your Information and Any body wants learn .NET through Online for Details Please go through the Link <a href="http://www.teksonit.com/dot-net-online-training/"> Best .NET Online Training in INDIA | .NET Certification Online in USA, UK, CANADA </a> This Will Helps you aalot.


reaper

reaper

5/14/2014

when I trying to run this website Got this error. {"HttpServerUtility.Execute blocked while waiting for an asynchronous operation to complete."} MVC.Blog.Tags() MVC.Blog.PopularBlogEntries()


Dor

Dor

11/19/2013

It doesn't matter, I managed to fix it. I would like to ask as well how it is possible to edit or insert pre-exisiting data on to the sql since otherwise the dates would be wrong.


Dor

Dor

11/19/2013

I appreciate your help, but when ever I change the SHA1 password I get an error


Daniel

Daniel

11/19/2013

@Dor: The default username and password is "admin". You could/should change this in web.config. See https://github.com/danielpalme/MVCBlog/blob/master/Setup/Readme.html for help.


Dor

Dor

11/19/2013

Hey, I would like to use your blog engine as a base for my website. But I'm not managing to figure out how to login


rodrigo

rodrigo

10/17/2013

Cool, thanks :D I student your code now haha :p


Daniel

Daniel

9/8/2013

@Mika: These is no register functionality and no user administration. But you you could add new user to Web.config (<Authentication /> section) manually.


Mika

Mika

9/8/2013

is it possible to create new users? :)