0

I know this is a weird question, but I was wandering to get this. I have a different published MVC solution. And I want to put that in a folder of my Sitecore application.

I was trying with the custom route pipeline.

In the folder named customAPI I have a separate published .NET MVC solution.

namespace CustomPipelines
{
    public class RegisterCustomRoute
    {
        public virtual void Process(PipelineArgs args)
        {
            Register();
        }

        public static void Register()
        {
            RouteTable.Routes.MapRoute("CustomRoute", "customapi/{controller}/{action}");
        }
    }
}



 <?xml version="1.0" encoding="utf-8"?>
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/">
    <sitecore>
        <pipelines>
            <initialize>
                <processor type="CustomPipelines.RegisterCustomRoute, MahindraAuto" patch:before="processor[@type='Sitecore.Mvc.Pipelines.Loader.InitializeRoutes, Sitecore.Mvc']"/>
            </initialize>
        </pipelines>
    </sitecore>
</configuration>

Is it even possible?

4
  • As in a separate non-sitecore MVC application?
    – Richard Seal
    Jan 8 '20 at 18:44
  • yes. It is totally a different solution. If I am putting an html, it is working, but a routing from a different solution is not picking up.
    – Arkadeep
    Jan 8 '20 at 18:45
  • Unable to test this now but can you try to add customAPI to the IgnoreUrlPrefixes, that way Sitecore should ignore it. Is the folder a virtual directory?
    – Jeroen
    Jan 8 '20 at 19:34
  • Its is a folder making an application in web app.
    – Arkadeep
    Jan 8 '20 at 19:46
1

If its a separate application that is not connected to Sitecore in anyway, then you can use a virtual folder or application in IIS to set it up, and then you simply need to add that folder name to the IgnoreUrlPrefixes setting in Sitecore.

<setting name="IgnoreUrlPrefixes" value="/customapi|/sitecore/default.aspx|/trace.axd|/webresource.axd|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.DialogHandler.aspx|/sitecore/shell/applications/content manager/telerik.web.ui.dialoghandler.aspx|/sitecore/shell/Controls/Rich Text Editor/Telerik.Web.UI.SpellCheckHandler.axd|/Telerik.Web.UI.WebResource.axd|/sitecore/admin/upgrade/|/layouts/testing"/>

That setting is a little hard to patch nicely. But there is a good solution here for that: https://firebreaksice.com/sitecore-patchable-ignore-lists/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.