Reputation: 5370
The following returns "/Settings"
Url.Action("Index", "Settings");
On my local this renders fine. However on my remote machine I get the error belows. I get the impression that the controller is not properly instantiated.
Parser Error Message: Could not load type 'System.Web.Mvc.ViewPage<EStore.Domain.ViewModel.SettingsViewModel>'.
Line 1: <%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<EStore.Domain.ViewModel.SettingsViewModel>" %>
Global.asax
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
routes.MapRoute(
"AdminCompany",
"{controller}/{action}/{companyId}/{id}",
new { controller = "Home", action = "Index", companyId = "", id = "" }
);
routes.MapRoute(
"Status",
"{controller}/{action}/{id}/{statusId}",
new { controller = "Home", action = "Index", id = "", statusId = ""}
);
routes.MapRoute(
"Admin",
"admin/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
Index Actions
public ActionResult Index()
{
var viewModel = IndexViewModel();
return View(viewModel);
}
Upvotes: 0
Views: 226
Reputation: 1255
public ActionResult Index()
{
var viewModel = IndexViewModel();
return View(viewModel);
}
Should that read var ViewModel = new IndexViewModel();
seems like you might be passing a null through.
Also, where is the route for settings? Is it meant to pick up from the default route using the home controller?
Upvotes: 0
Reputation: 1039298
It seems that the type loader cannot find the EStore.Domain.ViewModel.SettingsViewModel
class. Make sure this class is included in one of the assemblies in the bin
folder.
Upvotes: 1