• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 771
  • Last Modified:

converting mvc 1 to mvc 3 using Orchard CMS

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.
  • 7
  • 4
  • 3
4 Solutions
Bob LearnedCommented:
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?
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.
codeJenAuthor Commented:
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.
Improve Your Query Performance Tuning

In this FREE six-day email course, you'll learn from Janis Griffin, Database Performance Evangelist. She'll teach 12 steps that you can use to optimize your queries as much as possible and see measurable results in your work. Get started today!

Orchard is simple.

Find the links for documentation.
codeJenAuthor Commented:
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.
Bob LearnedCommented:
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

codeJenAuthor Commented:
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.
Bob LearnedCommented:
Unfortunately, my expertise is with MVC, but I have no experience with Orchard.

Here is one possible resource:

Building a hello world module
codeJenAuthor Commented:
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.
Bob LearnedCommented:
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
codeJenAuthor Commented:
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.
codeJenAuthor Commented:
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.
Hi Codejen,
Where is your Question regarding issue with the Orchard and Links?

I can help you out in Orchard.
codeJenAuthor Commented:
Experts Exchange new question started

Here is the new post started.   Thanks
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 7
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now