Solved

Adding MVC3 module to Orchard

Posted on 2013-02-04
7
584 Views
Last Modified: 2013-02-27
Hello experts.

My issue is adding a MVC3 application to Orchard.  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


Anyone know why this does not work like this or if there is another syntax I should try? ="<%=Url.Content("~/Content/Site.css")%>"

It works until I add the module to Orchard, then anything referencing another script, page, or CSS file breaks.
0
Comment
Question by:codeJen
[X]
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
  • 4
  • 3
7 Comments
 
LVL 9

Expert Comment

by:darjimaulik
ID: 38854125
Can you give us some idea about your MVC3 Application.
What is the Purpose of the application?
What will be added in the CMS.

Orchard is a CMS so there are some different ways to integrate application with a CMS.

I have worked on Orchard so I can help you out in this.
But before that i need some details on your application.
0
 

Author Comment

by:codeJen
ID: 38855311
Here is a brief description of my application.  It's in MVC3 and it's using a master page.  So far I haven't been able to make the master page work within Orchard.  
Using: MasterPageFile="~/Views/Shared/Site.Master"  Gives an error it can't find it but outside of Orchard this works as it should.

I have tried to add in the Orchard.Web module's web.config this:
<add name="ASPX" path="*.aspx" verb="*" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode" requireAccess="Script"/>

Open in new window

 in hope that it would recognize webforms.    Not sure if this is correct since I ran across this in a asp.net forum.  It didn't help my master page to show.

The whole purpose of this app is to display online products.  It should be as easy as moving it in Orchard without changes but not really knowing Orchard there may be things that are not compatible?  Guessing.
0
 
LVL 9

Expert Comment

by:darjimaulik
ID: 38855614
Orchard is MVC and it does not support webforms i.e. aspx pages.
so your master page will not work in orchard.

MVC Application can't have the master pages or webforms so i am bit confused that you say mvc app have master pages.

MVC and webforms dont go together.
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:codeJen
ID: 38855744
ASP.NET MVC 3 is a framework for building scalable, standards-based web applications using well-established design patterns and the power of ASP.NET and the .NET Framework.

Orchard is a Web CMS, which essentially aims at helping you build web sites from existing pieces. Orchard is built on ASP.NET MVC.

Is there any documentation that says webforms and orchard don't go together?
0
 
LVL 9

Accepted Solution

by:
darjimaulik earned 500 total points
ID: 38858246
All MVC based application and Orchard don't have by default support for webforms and master pages. They have different concept. So you should not mix.
We can add aspx and master pages but then why create an MVC Application.

As a standard practice if project is build in MVC then dont use ASPX pages in it. and vice versa.

Regarding Orchard, It is a Very flexible system. Check the below link - How you can have webforms page in Orchard.
 
http://stackoverflow.com/questions/6637696/webforms-page-inside-of-orchard-cms-application

But for Master pages please read this
http://orchard.codeplex.com/discussions/246117

Regarding your issue:
<link type="text/css" href="<%=Url.Content("~/Content/Site.css")%>" rel="stylesheet" /> 
<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

From your code i can say that the first line will try to find the css in Content folder in Root.


Output the path generated by url.content - It will be
C:\mywfg\MyWfg.com2\source\Orchard\src\Orchard.Web\Content\Site.css
It may not have the path till the module.

So you have to either give relative path till the module or you have to keep the css etc in the root folder.


Normal CMS Concept:
There is a Layout design (known as Base Page or Master Template or Layout Template) and add the modules in the given design so whole website have the same look and feel.

In orchard you dont have to create a master page for a Module but you should use the Layout.cshmtl to display.
0
 

Author Closing Comment

by:codeJen
ID: 38911227
Thanks for your wonderful feedback.
 
Unfortunatly I am faced with webforms not working in our Orchard enviroment.  I have tried the links given already, and the webforms still wouldn't display after making the web.config change.  

However, you did confirm the relative path issue I had so I consider this question answered.
0
 

Author Comment

by:codeJen
ID: 38933913
I wanted to add some links here that I really found helpful on top of the great support I received.  Being new to Orchard and Razor view engine has been quite a challenge.  Hopefully this will help anyone else out there new to Orchard and Razor.

I found a video that explains the fundamentals of Orchard and a link that explains the webforms to Razor and also a great explanation of Razor syntax.

Orchard Fundamentals

Intro to using Razor

Razor Pages with Webforms
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this blog, I will share you some basic tips for content marketing and to rank your website on Google.
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Suggested Courses

621 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