Question

I'm in the process of trying to integrate Piranha CMS (v2.2.0) with an existing ASP.NET MVC application. I can run all the original application pages, and the CMS manager pages. I can also see drafts of pages managed by the CMS, but when I try to view the live page version hosted from the CMS I get a HTTP 404 "The resource cannot be found" message.

So the following draft url works:

http://localhost:5316/draft/start

But the following live url fails:

http://localhost:5316/home/start

The original application does have a "Home" controller which I have tried renaming to "Test" in case of conflict issues. I could see the new "Test" located content, but the /home/start url still failed.

As advised, my RouteConfig code is:

routes.MapRoute(
    name: "Default",
    url: "{controller}/{action}/{id}",
    defaults: new { controller = "Home", action = "Index", id = UrlParameter.Optional },
    namespaces: new[] { "Maps.Portal.Controllers" }
).DataTokens["UseNamespaceFallback"] = false;

And my web.config settings are:

<settings>
  <managerNamespaces value="" />
  <disableManager value="false" />
  <passiveMode value="true" />
  <prefixlessPermalinks value="false" />
</settings>

I have tried setting the prefixlessPermalinks setting to true but this didn't help.

I'm guessing that Piranha CMS isn't catching the routes for pages hosted with itself? any ideas?

Was it helpful?

Solution

By looking at your config I can see that you have followed the guidelines for setting up Piranha CMS for an existing project by setting passiveMode to true. Let me clarify a bit what this parameter does.

Passive mode is used for applications where you only want to use Piranha CMS as a backend content store and not handle any routing. This means that this parameter effectively turns off all url's to permalinks in the system to not interfere with the existing routes of the application.

If you want to mix your existing application controllers with pages solely generated by Piranha CMS you have to set passiveMode to false which will make the routing for permalinks active again.

Once this is done you will be able to access your pages with or without prefixless permalinks.

Regards

Håkan

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top