Studies with MVC4 six: website background management
The backstage management part intends to use a separate area. Mainly for the establishment and management of the website, preliminary ideas to achieve the following functions:
First, the establishment of regional Admin.
In the project right click on the -> -> addition; regional. Enter the name "Admin".
Create a new directory
As can be seen from the chart, their model area. Controllers, views and routing, as a sub project.
Double click to open ControlAreaRegistration.cs
Change the code as follows:
using System.Web.Mvc;
namespace Ninesky.Areas.Admin
{
public class ControlAreaRegistration : AreaRegistration
{
public override string AreaName
{
get
{
return "Admin";
}
}
public override void RegisterArea(AreaRegistrationContext context)
{
context.MapRoute(
"Admin_default",
"Admin/{controller}/{action}/{id}",
new { action = "Index", id = UrlParameter.Optional }
);
}
}
}
Today write here.
Posted by Jack at November 17, 2013 - 12:08 PM