I am trying to integrate Piranha CMS into an existing ASP.NET MVC website. I have successfully converted my web application to use .net 4.5 MVC5 (initially it was .net 4.0, MVC4). I have added the PiranhaCMS.Mvc package which transitively added PiranhaCMS.Core package.
The getting-started guide stated to set the passiveMode to true. But I would prefer to use both mine and Piranha CMS routing mechanism. Hence I set the passiveMode to false. My Web.config is as follows:
<piranha>
<settings>
<managerNamespaces value="" />
<disableManager value="false" />
<disableTypeBuilder value="false" />
<passiveMode value="false" />
<prefixlessPermalinks value="false" />
</settings>
<providers>
<mediaProvider value="Piranha.IO.LocalMediaProvider, Piranha" />
<mediaCacheProvider value="Piranha.IO.LocalMediaCacheProvider, Piranha" />
<cacheProvider value="Piranha.Cache.WebCacheProvider, Piranha" />
<logProvider value="Piranha.Log.LocalLogProvider, Piranha" />
</providers>
</piranha>
My RouteConfig.cs contain the following:
routes.MapRoute("Default", "{controller}/{action}/{id}",
new {controller = "Home", action = "Index", id = UrlParameter.Optional},
new[] {"xxx.xxx.xxx.Controllers"}
).DataTokens["UseNamespaceFallback"] = false;
I can access the Manager console on "http://dev.test.com/manager". But when I try to access the main existing website "http://dev.test.com", I obtain a 404 error with Requested URL: /page
I have no idea what is /page. Also I tried to create a page on the Manager console with the permalink being "http://dev.test.com/home/enews". When accessing the latter, It seems being redirected and I obtain the same 404 error as above with Requested URL: /page.
Note that when I set passiveMode to true, I can access my main existing website "http://dev.test.com". I am really looking forward to integrate Piranha CMS in my existing application and hopefully obtain guidance from someone.
When you create an application using the template project (i.e PiranhaCMSMvc) you get two basic controller templates in your project, one for displaying pages and one for displaying posts. When you simply add the Piranha.Mvc package you don't get any of the template files.
What happens when you navigate to http://dev.test.com is that the Piranha CMS routing finds the start page, then it routes it to ~/page which in the default template would be the PageController. Since this controller isn't found you get a 404 error.
The easiest way to get started is to create a new blank application using the PiranhaCMSMvc NuGet package and take a look at the controllers included. You can then copy them to your existing application.
Best regards
Håkan