Integrate ASP.NET MVC 3 solutions within a website
To integrate an ASP.NET MVC 3 solution within a C1 website:
- Install the Composite.AspNet.MvcPlayer package.
- In the Content perspective, edit a page, or in the Layout perspective, edit a template.
- Insert theComposite.AspNet.MvcPlayer.Renderfunction (Insert>Function) or add the following code:
<f:function name="Composite.AspNet.MvcPlayer" xmlns:f="http://www.composite.net/ns/function/1.0"> <f:param name="Path" value="/Home" /> </f:function>
4. Specify the path to the controller/action/id in the Path parameter, e.g. "/Home".
Note: The Razor syntax is supported.
Important Notes
- Multiple MVC Player instances cannot run on the same page. (The MVC Player gets the path from either the PathInfo or its parameter if the PathInfo is empty. Multiple MVC Player functions on the same page will thus get the same path from the PathInfo.)
- Routes must be registered in
~\App_Code\Composite\AspNet\MvcPlayer\Route.csinstead ofGlobal.asax. - The markup you create in your MVC application must be valid XHTML (closing tags, quotes around attribute values, no raw '<', '&' and other similar characters). To avoid validation errors with script code:
- We highly recommend putting scripts in separate files and insert them in the markup via
<script src="..." />. - You may also consider using CDATA to enclose your text that should be ignored by the XML parser.
- We highly recommend putting scripts in separate files and insert them in the markup via
Requirements
Composite C1 version 2.0 SP 1 or later
ASP.NET MVC 3 or later must be installed on the web server. If not installed, you will receive a validation error when trying to install this package. In this case, install MVC 3 and then reinstall this package. Visit http://www.asp.net/mvc/mvc3 to download the required bits.
Paste from Word not accepted. Please cleanup markup. Use the "import from Word" feature; or paste the content into Notepad, then copy it again.
Paste from Word not accepted. Please cleanup markup. Use the "import from Word" feature; or paste the content into Notepad, then copy it again.