Solved

converting mvc 1 to mvc 3 using Orchard CMS

Posted on 2013-01-29
15
725 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
15 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 400 total points
Comment Utility
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 100 total points
Comment Utility
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
Comment Utility
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
 
LVL 9

Expert Comment

by:darjimaulik
Comment Utility
Orchard is simple.

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

Author Comment

by:codeJen
Comment Utility
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 400 total points
Comment Utility
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
Comment Utility
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
What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 400 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Experts Exchange new question started

Here is the new post started.   Thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

DotNetNuke (DNN) (http://www.dotnetnuke.com) is a leading open source web content management system (CMS) and application development framework for Microsoft .NET. Localization is an essential part of building websites, especially in countries that …
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

728 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now