- Developer Resources
- MVC Page Routing and Embedded Web Applications
MVC Page Routing and Embedded Web Applications
One of the platform’s design requirements was to support a modular framework that allowed for web applications to be dynamically embedded. This requirement was achieved with an open source project called MVC Code Routing. This component allows a web application to add a reference to another web application and bind those pages to an MVC path in the host application. There are some rules to follow when building web applications, such as:
- It is recommended to create your module web controllers, models and view in the main website for debugging purposes first, then move all related files to the embedded web application once completed.
- Views in the web application module must have the Build Action property set to be “Embedded Resource” so that the View is compiled as an assembly resource.
- 3rd party user interface components are not required in the embeddable web application if they are installed in the host web application.
- Dots (.) are used as path separators. For example, accessing a website path of /Products/MyProduct is defined as the path "Products.MyProduct" which will call the MyProductController object.
- Don't use dots (.) in the view file name except for the extension. When attempting to map a virtual path to an assembly resource, dots are interpreted as path separators (/).
- Use “~~” prior to a controller name to start in the application root. Use the “+” prior to a controller path to denote it is a child of the current path.