Are you as exited as I am over the new EPiServer 7 with MVC support and typed pages?
I hope you are, and therefore I thought that I might put together this blog post showing how to set up an EPiServer 7 site with MVC 4 from scratch. Please follow along!
First start by downloading EPiServer 7 from the EPiServer world web site. Once you’re finnished with that, continue setting up an new EPiServer 7 site with EPiServer Deployment Center.
Start “EPiServer Deployment Center” and choose “Install site and SQL Server database(CMS 7.0.586.1)”. Once the installation completes you can now fire up Visual Studio to create a new ASP.NET MVC 4 WebApplication. Save it in another location than your previously installed EPiServer site.
When the Web application project is created, copy all files except Global.* och Web.* and paste them in the location of the EPiServer site

Set up groups and users
To be able to log in to the administartion interface we need to create the “WebAdmins” and “Administrators”-group, as stated in the <authorization>-element in web.config.
Make sure that roleManagers defaultProvider is set to “SqlServerRoleProvider” and that the defaultProvider of the membership is set to “SqlServerMembershipProvider”. This is done so that we can create groups and users in the database next.
You do this by going into the ASP.NET Configuration site from Visual Studio (se picture below)

Create an “admin” user as well and put it in the “WebAdmins” and “Administrators” group.
Go to the administration interface by, in my case, entering the following URL in your favourite web browser: http://epi7mvc/sec/UI/CMS/Admin/
You will get a warning text stating that the site has no content. Do as the text says and set pageStartId=”1″ on the siteSettings-elementin episerver.config
Save your changes and once more enter the admin url in your browser: http://epi7mvc/sec/UI/CMS/Admin/ .
Log in using your newly created “admin”-user.
You should now get the new admin interface of EPiServer 7
Creating your first content
What would a site be without any content or pages, not much if you ask me… ![]()
So it’s time to dive into Visual Studio and start creating a PageType.
We start with the creation of a StartPage-pageType. Create an folder “Types” and in that create a new class “StartPage” (as can be seen in the picture below)

Create a partialView for yout type in “Views/StartPage”. Name it “Index.cshtml”.
@using EPiServer.Web.Mvc.Html @model EPi7Web.Types.StartPageModel <h1>@Html.PropertyFor(x => x.MainTitle)</h1> @Html.PropertyFor(x => x.MainBody)
Create a controller named “StartPageController.cs” in the “Controller”-folder.
using System.Web.Mvc;
using EPi7Web.Models;
using EPi7Web.Types;
using EPiServer.Web.Mvc;
namespace EPi7Web.Controllers
{
public class StartPageController : PageController<StartPage>
{
//
// GET: /StartPage/
public ActionResult Index(StartPage currentPage)
{
var model = new StartPageModel() { MainBody = currentPage.MainBody, MainTitle = currentPage.MainTitle};
return View(model);
}
}
}
Go into the edit interface and create a new page (“Home”) based on the StartPage-type.
Notice the pageId (“4″) that this new page received when it was created. Insert this pageStartId into the siteSettings-element.
Update the page with some content and then “Publish” it
Hopefully you will see your new page when going into the view-/editmode.

Hope that you have found this blog post helpfull!






