Click here to Skip to main content
Click here to Skip to main content

Create Your First MVC Project in Umbraco (ver 6)

, 15 Jun 2013
Rate this:
Please Sign up or sign in to vote.
How to create your first MVC project in Umbraco

Introduction

Here, I am going to create a new blank MVC4 project in Microsoft Visual Studio 2010 and then I will add Umbraco 6.0.3 package to it. In this process, unfortunately, you may encounter a couple of bugs which have been highlighted in yellow.

Background

Umbraco is an open source ASP.NET CMS. More information regarding it can be found here.

Using the Code

  • Create an empty MVC 4 project in Visual Studio.
  • Add the NuGet Umbraco Cms Core Binaries package to manage various dependencies and references that Umbraco 6 requires. To do this, open Package Manager Console (From the Tools menu, select Library Package Manager and then click Package Manager Console) and type Install-Package UmbracoCms.Core -Version 6.0.3.

  • Download and copy all the files from the Umbraco installation ZIP archive directly into your project in Visual Studio except the App_Code and Bin folders – you won’t need the binaries as they are managed by NuGet and the App_Code folder is not used in a web application project.
  • Change the default mode for Umbraco from web forms to MVC in the defaultRenderingEngine setting in the Umbraco configuration file UmbracoSettings.config as shown below:
<templates>
	
<useAspNetMasterPages>true</useAspNetMasterPages>
<defaultRenderingEngine>Mvc</defaultRenderingEngine>
	
</templates>  

Unfortunately, if you run the application now, you may encounter the error ApplicationException: The current httpContext can only be set once during a request.

The solution is to do the following in the web.config file.

Copy the httpModules tag and keep it handy for later use.

Add <add name="umbracoRequestModule" type="umbraco.presentation.requestModule" />
Add <add name="umbracoBaseRequestModule" type="umbraco.presentation.umbracobase.requestModule" />
Comment out <!--<add name=" UmbracoModule" type="Umbraco.Web.UmbracoModule,umbraco" />--> 
<httpModules>
<!-- URL REWRTIER -->
<add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, 
UrlRewritingNet.UrlRewriter" />
<add name="umbracoRequestModule" type="umbraco.presentation.requestModule" />
<!-- UMBRACO --> 
<!--<add name=" UmbracoModule" type="Umbraco.Web.UmbracoModule,umbraco" />-->
<add name="umbracoBaseRequestModule" type="umbraco.presentation.umbracobase.requestModule" />
<!-- ASPNETAJAX -->
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, 
System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<!-- CLIENT DEPENDENCY -->
<add name="ClientDependencyModule" type="ClientDependency.Core.Module.ClientDependencyModule, 
ClientDependency.Core" />
</httpModules> 

Now the application will debug successfully and the Umbraco installation wizard will start to configure Admin and DataBase details.

The five steps of the wizard are displayed below:

Points of Interest

The following articles were consulted to compose this blog. For more details of any particular domain, click on the appropriate link below:

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

piyush_singh
Software Developer
India India
No Biography provided
Follow on   Twitter   Google+   LinkedIn

Comments and Discussions

 
QuestionIs it free Pinmembersachinthamke21-Jan-14 5:09 
AnswerRe: Is it free Pinmemberpiyush_singh21-Jan-14 20:10 
GeneralFirst time worked on Umbraco CMS PinmemberJuhi Paunikar2-Jul-13 0:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140709.1 | Last Updated 15 Jun 2013
Article Copyright 2013 by piyush_singh
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid