ASPNetFAQ.com: What is ASP.NET?

Technology posts on ASP.NET, IIS, Windows (+ a little Linux), Cloud Servers, Hosting, and more!
  • Blog Home
Search the site...

Orchard: Custom Content in Sub-Folders

Tweet
Share
0 Shares

Orchard doesn’t seem to like anything in it’s web root except for it’s own content. Try it out – create a folder (I created /TestContent/) and then put a test from there (I created test.html) and try to access it. You’ll get a 404 error. Orchard “traps” all requests and effectively kills them if it doesn’t like them. That’s a bummer though if you want to drop some custom content on your site somewhere for some reason. Let’s see what we can do about it.

I created a default Orchard site. No changes and running the default recipe selected during the initial configuration.

I created a folder named “TestContent” so that it would be available at <orchardsite>/TestContent/

I created a simple HTML file named “test.html” so that it would be available at <orchardsite>/TestContent/test.html

I confirmed that I got a 404 error trying to access the file.

OK. So now let’s see what we can do to fix this issue. There was a lot of research and testing for a solution and I spare you those details and just show how I got past the error.

I surrounded <system.web> and <system.webServer> with location tags to prevent the settings from pushing to all subfolders…

<location inheritInChildApplications="false">
  <system.web>
    ...
  </system.web>
</location>
...
<location inheritInChildApplications="false">
  <system.webServer>
    ...
  </system.webServer>
</location>

I also converted the /TestContent/ folder to an application in IIS. This can be done via many hosting control panels or directly through IIS (either on-server or via the IIS7 Remote Management tool).

Convert a folder an to application in IIS

Great, now my test URL works! But it seems also that the formatting within Orchard has broken. So…

I added another section to the web.config file. This time just below the ending location tag that I wrapped around the system.webServer section.

...
</system.webServer>
</location>
<!--
EDIT: Adding this next section to "fix" the Orchard formatting
-->
 <location path="Themes">
   <system.webServer>
     <validation validateIntegratedModeConfiguration="false" />
     <handlers accessPolicy="Script">
       <remove name="StaticFile" />
     </handlers>
   </system.webServer>
 </location>
 <location path="Core">
   <system.webServer>
     <validation validateIntegratedModeConfiguration="false" />
     <handlers accessPolicy="Script">
       <remove name="StaticFile" />
     </handlers>
   </system.webServer>
 </location>
 <location path="Media">
   <system.webServer>
     <validation validateIntegratedModeConfiguration="false" />
     <handlers accessPolicy="Script">
       <remove name="StaticFile" />
     </handlers>
   </system.webServer>
 </location>
 <location path="Modules">
   <system.webServer>
     <validation validateIntegratedModeConfiguration="false" />
     <handlers accessPolicy="Script">
       <remove name="StaticFile" />
     </handlers>
   </system.webServer>
 </location>
<!--
EDIT: Adding the above section to "fix" the Orchard formatting
-->
 <runtime>
...

And then the Orchard formatting started working again… And the test page in the test folder still worked!

Problem solved? I think so. It seems that this solution works great for me. If you have a different experience with this solution please let a comment and share with the world.

Happy hosting!

More from my site

  • Resolving a “There is a duplicate ‘system.web.extensions/scripting/scriptResourceHandler’ section defined” ErrorResolving a “There is a duplicate ‘system.web.extensions/scripting/scriptResourceHandler’ section defined” Error
  • IIS7 Mime MappingsIIS7 Mime Mappings
  • PUT/POST/DELETE Verb Errors On SitePUT/POST/DELETE Verb Errors On Site
  • Log Parser: Pulling Valuable Data From IIS LogsLog Parser: Pulling Valuable Data From IIS Logs
  • Linking spam sent through shared IIS SMTP server to a userLinking spam sent through shared IIS SMTP server to a user
Tweet
Share
0 Shares
ASP.NET, CMS, cytanium, Development/Coding, Hosting, IIS, Orchard, OrcsWeb, System Administration, tip, Troubleshooting

Comments are closed.

Proverbs 19:20

"Get all the advice and instruction you can, so you will be wise the rest of your life."

A Note On WordPress Hosting

Our main focus is of course .NET, but with a mix of Linux, virtualization, and other technologies. But if you're really looking for the best WordPress hosting specifically, read my WordPress host review to save yourself hassle AND money!




Recent Posts

  • What makes good web hosting?
  • jQuery Mobile C# ASP.NET and N5 Networks Software Repository
  • Open Source Bug Tracking Software and the Orchard Project
  • ASP.NET Development with Dreamweaver MX: Visual QuickPro Guide
  • Kendo UI Sample, ASP.NET Ajax Tutorial & More

Tags

ASP.NET Automation centos CMS css cytanium Development/Coding Email gmail Hosting htaccess http https IIS javascript Learning Linux logparser MySQL nginx openssl OrcsWeb performance PowerShell redirect RHEL security server SherWeb smtp SQL/Databases ssl System Administration telnet terminal tip Troubleshooting Ubuntu virtualization Visual Studio web farm web hosting Windows windows server Wordpress

Categories

  • ASP.net development
  • Development/Coding
  • Hosting
  • IIS (Internet Information Services)
  • SQL/Databases
  • System Administration
  • Virtualization
(c) ASPNETFAQ.com