
I ran into an exception “Could not load type ‘System.Web.Mvc.ViewPage” or something along those lines while trying to implement “Areas” for Asp.Net MVC 2.
So if you are coming up against this issue, you might be having that same issue.
The solution, drop in a copy of the web.config from the views folder into the folder for your areas folder (i.e. Areas/AreaName or Areas/AreaName/Views). Refresh. That should solve that exception. Hopefully.
Tags: areas, asp.net mvc, asp.net mvc 2.0, exception

Using the css classes on the body tag/element, you can open a door to having finer control over the layout of your site. Its one of the few decent tricks that bigger Content/Course Management Software like drupal or moodle provides.
In Asp.Net Mvc this can be done in the master page, outside of the head tags. What makes this nice is using the controller and action name to isolate the page and section of the site you are int.
</head>
<%
var values = Html.ViewContext.RouteData.Values;
var bodyClasses = values["controller"] + " " +
values["action"];
%>
// in the master page
<body class="<%= bodyClasses %>">
// what should be rendered for the url: /blog/edit/5
<body class="blog edit">
As you can see above, it would pay off to stick to using the controller and action keywords in your routing. You could adjust the above for adding the modules/areas name.
.blog aside.column {
display: none;
}
.blog.edit footer {
margin-top: 20px;
background: transparent(images/egg.png) no-repeat;
}
You can now target certain aspects of the layout and change it depending what section of the site you are in.
Tags: #AspNetMvc, action, asp.net mvc, body, controller, css, element, name, tag