[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

converting mvc 1 to mvc 3 using Orchard CMS

Posted on 2013-01-29
15
Medium Priority
?
757 Views
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.
0
Comment
Question by:codeJen
  • 7
  • 4
  • 3
14 Comments
 
LVL 96

Accepted Solution

by:
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?
0
 
LVL 9

Assisted Solution

by:darjimaulik
darjimaulik earned 200 total points
ID: 38835085
Hi Codejen,

You can check the following links
http://stackoverflow.com/questions/4888810/how-do-you-directly-upgrade-asp-net-mvc1-to-mvc3

http://forums.asp.net/t/1651672.aspx/1?how+to+upgrade+MVC+1+project+to+MVC+3+Razor+trouble+

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.
0
 

Author Comment

by:codeJen
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.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
LVL 9

Expert Comment

by:darjimaulik
ID: 38835126
Orchard is simple.

Find the links for documentation.
http://docs.orchardproject.net/
0
 

Author Comment

by:codeJen
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.
0
 
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"?>
<configuration>
  <configSections>
    <sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
      <section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
    </sectionGroup>
  </configSections>
  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc" />
        <add namespace="System.Web.Mvc.Ajax" />
        <add namespace="System.Web.Mvc.Html" />
        <add namespace="System.Web.Routing" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>
  <appSettings>
    <add key="webpages:Enabled" value="false" />
  </appSettings>
  <system.web>
    <httpHandlers>
      <add path="*" verb="*" type="System.Web.HttpNotFoundHandler" />
    </httpHandlers>
    <!--
        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=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" pageBaseType="System.Web.Mvc.ViewPage, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" userControlBaseType="System.Web.Mvc.ViewUserControl, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <controls>
        <add assembly="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" namespace="System.Web.Mvc" tagPrefix="mvc" />
      </controls>
    </pages>
  </system.web>
  <system.webServer>
    <validation validateIntegratedModeConfiguration="false" />
    <handlers>
      <remove name="BlockViewHandler" />
      <add name="BlockViewHandler" path="*" verb="*" preCondition="integratedMode" type="System.Web.HttpNotFoundHandler" />
    </handlers>
  </system.webServer>
</configuration>

Open in new window

0
 

Author Comment

by:codeJen
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.
0
 
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
http://docs.orchardproject.net/Documentation/Building-a-hello-world-module
0
 

Author Comment

by:codeJen
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.
0
 
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
http://paulmason.biz/?p=118

About The Orchard Project
http://orchard.codeplex.com/

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
0
 

Author Comment

by:codeJen
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.
0
 

Author Closing Comment

by:codeJen
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.
0
 
LVL 9

Expert Comment

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

I can help you out in Orchard.
0
 

Author Comment

by:codeJen
ID: 38855217
Experts Exchange new question started

Here is the new post started.   Thanks
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
The burden of debt that average person carries today has not only increased, but it keeps on growing. It is quite common nowadays that people find it extremely difficult to make ends meet in the face of millions of competing priorities that they hav…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month19 days, 20 hours left to enroll

872 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