Integrating Sitefinity Pages into existing MVC3 application

Posted by Community Admin on 03-Aug-2018 19:01

Integrating Sitefinity Pages into existing MVC3 application

All Replies

Posted by Community Admin on 24-Oct-2012 00:00

Hello there, I'm currently evaluating Sitefinity and I'm really enjoying it. But for our project we don't need a full CMS which handles every single aspect of our site. What we would like to do is create a few pages (with multi-lingual content) and render them from an existing MVC3 application.

Not the whole page though, but only as a section of our site. This would enable us to allow our editors to modify non-technical content with the WYSIWYG designer while keeping our developers in control of the technical aspects of the site.

Let's say I create a page called "Home" in the Sitefinity dashboard and fill it with some content (visually), I would then like to simply render this page as part of an existing MVC3 site.

Basically like this:

<html>
<head></head>
<body>
   <span>Some Html</span>

   @ SomeHelper.RenderSitefinityPage("/home");

</body>
</html>

I don't think there is a helper function for that, maybe because nobody ever needed it or wanted it, but I would be grateful if someone could put me in the right direction on how to activate the Sitefinity pipeline from code and output whatever it returns.

I'm only talking about actual content pages, the Sitefinity admin dashboard would just be routed via configuration (No custom code to call that)

Posted by Community Admin on 30-Oct-2012 00:00

Hello Simon,

Let me share my thoughts on the topic:

Since you are having in mind an MVC 3 application, the better approach would be to integrate that application into the CMS pages powered by Sitefinity. You can have Sitefinity and the same application in the same project and either run the MVC app in Pure or Classic MVC mode. This will require no rewriting of existing functionality, since Sitefinity supports both modes (link here). For instance, when you create the home page, it will be based on MVC template and it will render data from your application with MVC widgets. So this approach offers you to integrate your MVC 3 application into Sitefinity and use it this way

Another alternative is to utilize jQuery.load() method and use it in your MVC 3 application to get the html generate by Sitefinity. This will be the easiest and the quickest way to allow you to take either the whole page and render it in your MVC 3 application or take just a portion of the page, e.g. the inner HTML of a specific div element. Another good thing is that you will take the most out of our caching and this will be a very fast way for you to take the needed markup and you won’t put burden on the Server for each request. We also have get HTML methods for pages, but they are executed on API level and thus caching will not work.

I hope this helps! 

Cheers,
Peter
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed