An ordinary WebMatrix app in an Umbraco subfolder

I have an ordinary WebMatrix app with a bunch of .cshtml’s, a SQL CE database, some nuget dlls and helpers. And now after very little effort I seem to be able to run it beautifully together with an Umbraco 4.7 site. I still need to test it more thoroughly but initial tests have been running perfect.

Here’s how:

1) Add a reserved path for the app in web.config:

<add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/myapplication/" />

2) Enable webpages in web.config:

<add key="webpages:Enabled" value="true" />

3) Add a separate web.config file in the app path (/myapplication) to set the cshtml base class to the standard WebPages page base type (System.Web.WebPages.WebPage), and not the Umbraco one (umbraco.MacroEngines.DynamicNodeContext):

<configuration>
  <system.web.webPages.razor>
    <pages pageBaseType="System.Web.WebPages.WebPage">      
      <namespaces>
        <add namespace="Microsoft.Web.Helpers" />
      </namespaces>
    </pages>
  </system.web.webPages.razor>
</configuration>

Now I can run ordinary .cshtml files completely outside Umbraco context from my /myapplication/ folder.

Big thanks to Elijah Glover for helping me out with this.

I’m about to try the other way around aswell, i.e. run Umbraco from within a subfolder.

Advertisements

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s