How to transfer the model to the home page of MVC 3 Razor?
The Razor viewer is different from the aspx viewer.
The layout page will βinheritβ the content page model. Are you trying to make the layout page have a different model than the content page?
I'm not sure if _Layout.cshtml can have a separate model.
Perhaps you should explore the MV-VM configuration with ViewModels, which inherit from the BaseViewModel class, which provides the necessary general data needed for _Layout.cshtml "MasterPage".
Great info on MVVM here: Stack Overflow: MVVM ViewModel vs MVC ViewModel . Also information on how to include the general ViewModel functionality in the base class: Stack overflow: move the general ViewModel function in the base class?
[Update] The link in Martin's original comment, although it does not represent a direct duplicate of your problem, includes some information on how to introduce the basic ViewModel functionality without the need for a controller that needs to know about it ... re-link here: Stack overflow: transferring data to the home page in ASP.Net MVC
There is no difference between the viewer because the model is not part of the presentation layer. Use the base application controller to create and populate a common model and pass a reference to it in the ViewBag property of the request context. Read:
Data Transfer for Viewing Basic Pages - ASP.NET Tutorial
ViewBag dynamics in ASP.NET MVC 3
public ActionResult Test(TestModel model) { }
TestModel is a model class. Thus, you can transfer the model to the main page