Want to move .cshtml file into mojoportal.

If you have questions about using mojoPortal, you can post them here.

You may want to first review our site administration documentation to see if your question is answered there.

This thread is closed to new posts. You must sign in to post in the forums.
2/16/2012 6:22:13 PM
Total Posts 1

Want to move .cshtml file into mojoportal.

I have a new website using mojoportal within webmatrix.  It's running OK.  I have an older website (also WebMatrix), but not mojoportal.  I want to copy one page from that old site into my mojoportal site.  When I do that using HTML fragment feature, I see the HTML rendered properly, but the razor code is not being recognized as such. How can I get the page to act on razor code?  Thanks.

2/16/2012 7:30:37 PM
Total Posts 1201
Proud member of the mojoPortal team

Help support mojoPortal!
Add-on modules

Re: Want to move .cshtml file into mojoportal.

I'm not familiar with Razor, but since it's based on MVC you may not be able to get it to work within the context of mojoPortal (which is based on WebForms). See this thread for a little more info from Joe on this.

If it's just one page from the old site, I'd recommend that you either rewrite it to be a standalone aspx page (take a look at the ones delivered with mojoPortal for examples), or create a custom module that you can reuse within mojoPortal.


2/16/2012 7:34:09 PM
Total Posts 2192

Re: Want to move .cshtml file into mojoportal.

To add to what Jamie said, the HTML Fragment Include module will not work for including any kind of server-side code. It simply renders whatever is in the "fragment" file. It doesn't execute any code in that file.

-Joe D.

2/18/2012 8:11:49 AM
Total Posts 533
feet planted firmly on the ground

Re: Want to move .cshtml file into mojoportal.

I think you could feasibly include razor "pages" within a mojoPortal web site (http://www.hanselman.com/blog/IntegratingASPNETMVC3IntoExistingUpgradedASPNET4WebFormsApplications.aspx)

but I don't think you could share the skinning (via layout.master), and I'm pretty sure you could not do a razor feature that could be placed on a mojoPortal page.

7/23/2012 3:48:19 AM
Total Posts 121

Re: Want to move .cshtml file into mojoportal.

An old post I know, but I happened to be playing around in this area, and have successfully run a WebMatrix razor ASP.Net Weg Page within a mojoPortal site.  To include this onto a true mojoPortal page I had to use an iframe feature, with the URL set to the cshtml page.

My cshtml page pushes out a data grid from an OData service, so I dropped Microsoft.Web.Helpers.dll and Microsoft.Web.Helpers.OData.dll into the \bin folder of the site, with no apparent ill-effects. The dlls for Web Pages and Razor were already present.

I know this is not an ideal architecture but it may answer the OP.

You must sign in to post in the forums. This thread is closed to new posts.