converting mvc 1 to mvc 3 using Orchard CMS

Posted on 2013-01-29
Medium Priority
Last Modified: 2013-02-05
Hello Experts.

I am forced to use this CMS, Orchard, and I am not familiar with it at all.  I have an older version of a MVC 1 program that needs to be converted to MVC 3 and use Orchard.

My question is, since all of the views in Orchard CMS have CSHTML extension written in Razor, can I add a module with a ASPX and ASCX pages?  Is it compatible?

My issue is getting the application to see my included files like JQuery scripts, master page and any CSS files.  I can't seem to get the links to work images don't show and the only thing I can come up with is, since Orchard is written with Razor it doesn't like <%%> syntax?

Open for any comments or questions.
Question by:codeJen
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 3
LVL 96

Accepted Solution

Bob Learned earned 800 total points
ID: 38834894
That sounds like an interesting challenge.  The Razor engine is preferred, but all the markup transitions are different.  I don't believe that you can mix Web Forms and Razor.  You could either stay with the Web Forms engine, or change all the file extensions, and transitions to the Razor syntax.  

How many views do you have?

Assisted Solution

darjimaulik earned 200 total points
ID: 38835085
Hi Codejen,

You can check the following links


Orchard is an CMS. And you should not add the modules with aspx and ascx.
There are different way of writing images in Razor Syntax. So check that.
Orchard is having big community so you will be able to find ready made modules.

Author Comment

ID: 38835100
I have about 14 views.  It's a huge challenge.  :(  I have tried to convert the pages to CSHTML using a convertor tool for Visual Studio 2010 but i think there may be more than just changing the views.  I haven't gotten that far yet but I think my web.config needs to be updated to.  The documentation out there for Orchard is very limited.
Get proactive database performance tuning online

At Percona’s web store you can order full Percona Database Performance Audit in minutes. Find out the health of your database, and how to improve it. Pay online with a credit card. Improve your database performance now!


Expert Comment

ID: 38835126
Orchard is simple.

Find the links for documentation.

Author Comment

ID: 38835153
Hello Darjimaulik,

I have my module converted now.  It's adding it to Orchard.  So are you saying that Orchard doesn't support ASPX and ASCX pages?

If so, then I guess that answers my question for adding it to Orchard like it is, in MVC3.  What would you suggest to make it work in Orchard then?  Start a new module?  I have read that orchard link a few times.  Orchard has not been easy here for us and I've just begun to learn it.
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 800 total points
ID: 38836245
Since I haven't used MVC 1, I don't know how much is different between that and MVC 3, but I would imagine that it might be a lot of changes.  MVC 3 uses convention vs. configuration.  The system assumes that controllers are under the Controllers folder, with the name suffixed by "Controller" (i.e. AccountController).  

The views are under the Views folder in a sub-folder that matches the controller (i.e. Views\Account\Login.cshtml).

The web.config file has entries that relate to configuring the Razor engine.

Here is one from one of my web sites:

<?xml version="1.0" encoding="utf-8"?>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
    <add key="webpages:Enabled" value="false" />
      <add path="*" verb="*" type="System.Web.HttpNotFoundHandler" />
        Enabling request validation in view pages would cause validation to occur
        after the input has already been processed by the controller. By default
        MVC performs request validation before a controller processes the input.
        To change this behavior apply the ValidateInputAttribute to a
        controller or action.
    <pages validateRequest="false" pageParserFilterType="System.Web.Mvc.ViewTypeParserFilter, System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
        <add assembly="System.Web.Mvc, Version=, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
    <validation validateIntegratedModeConfiguration="false" />
      <remove name="BlockViewHandler" />
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />

Open in new window


Author Comment

ID: 38836726
Hello TheLearnedOne,

In converting my MVC1 to 2 and then 3, I found some white papers online with Microsoft that helped me through this one.  At first I tried using a convertor tool and it didn't work very well, so I decided to do it manually.  These white papers were perfect for this.

upgrade MVC1 to 2

upgrade to MVC3 from MVC2

Now that I have it working and converted to MVC3, would it be as simple as packaging it up and adding it to Orchard as a new module?  

I've read the online Orchard docs and really haven't seen a case where someone has documented how to add an exisiting MVC3 project into Orchard using ASPX.  So this is what I am guessing is the next step.  
Package the MVC3 project up.  This is upder Properties and Package/Publish web.  Then once that is created add existing module through the Orchard admin dashboard screen from my PC?  Since the folder structure in Orchard is a bit different I am unsure if this is the correct way and worried I may mess something up since I am new to Orchard.
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 800 total points
ID: 38836802
Unfortunately, my expertise is with MVC, but I have no experience with Orchard.

Here is one possible resource:

Building a hello world module

Author Comment

ID: 38836947
After working with MVC I don't understand why they need to use this Orchard stuff. LOL  Oh well.  Thanks for your input and I did notice in your config file there are some places I need to set up Razor if I did go the route of converting this to use Razor.  Thank you again.
LVL 96

Expert Comment

by:Bob Learned
ID: 38837092
Orchard is a content management application, and is a wrapper around MVC 3; not a replacement for.

Why I Love Orchard CMS

About The Orchard Project

Individual .NET-based applications that appeal to end-users , scripters, and developers
A set of re-usable components that makes it easy to build such applications
A vibrant community to help define these applications and extensions

Author Comment

ID: 38851182
Yes, I have read the docs and understand what Orchard is now.  Thanks.  However my issue is adding a MVC3 project into Orchard.  I have not read anything that tells me how to do this.

Which is why I am asking the experts here.  My issue is that my MVC3 is asp.net and the Orchard is Razor.  My paths to images, java script files and JQuery scripts do not work unless I put the path to my C: drive where the files are located.  Going across 3 enviroments isn't going to work like this.  
To show an example here is how the script is currently and not working:
<link type="text/css" href="<%=Url.Content("~/Content/Site.css")%>" rel="stylesheet" />

Open in new window

This is the only way it will work that I can find so far.
<link type="text/css" href="C:\mywfg\MyWfg.com2\source\Orchard\src\Orchard.Web\Modules\WFG.OnlineProductGuide\Content\Site.css" rel="stylesheet" />

Open in new window

Why does it not work like this? ="<%=Url.Content("~/Content/Site.css")%>"

It works until I add the module in to Orchard, then all of the links break.

If there is anyone that can answer this then you win!  It's been weeks of reading these Orchard docs and I can't find an answer.

Author Closing Comment

ID: 38851336
Thank you to everyone and their feedback.  I have moved this question to focus more on why my links do not work once added to Orchard.

Expert Comment

ID: 38853756
Hi Codejen,
Where is your Question regarding issue with the Orchard and Links?

I can help you out in Orchard.

Author Comment

ID: 38855217
Experts Exchange new question started

Here is the new post started.   Thanks

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
There is a massive demand for content on the web right now, and it doesn't look like it's going to stop any time soon. But, if you are running a business blog, it's not just enough to offer your audience lots of content. It needs to be high-quality…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question