Virtual Happy Hour this month, Jun 28, we'll be getting a sneak preview at our soon to launch SaaS CMS!

Try our conversational search powered by Generative AI!

Can you setup ignore routing in EPi?


I have an existing website - a WebForms project - that hooks into EPiServer. Call it
EPi is on control of routing, though I am unsure how it manages routing (newbie).
I would like to build out a new route - call it - using a new WebForms page/code-behind and (important!) will not result in 404 from EPi.

In fact, I would like EPi to ignore and all of its child routes completely, allowing me to build the base page for a new SPA within the existing website. Allowing me to have

  • etc

Basis for the request is to create something akin to an index.html or index.aspx in that ignored location within the folder structure of the existing WebForms project, and load a SinglePageApplication within it.

I have attempted this, but EPi results in 404s for the SPA's routed views. Other words, may load in the browser, but all routed templates result in 404s.

Is there a recommended approach for handling this problem? Was thinking of establishing ignore routes, but with EPi in control of routing, I wasn't sure where to start. Any guidance is appreciated.

Jul 05, 2016 18:46

First register a route for your webform pages. You can do this in global.asax by overriding the RegisterRoutes method:

public class EPiServerApplication : EPiServer.Global
        protected override void RegisterRoutes(System.Web.Routing.RouteCollection routes)
                "~/Views/SPAStartPage.aspx", false, new RouteValueDictionary() { { "firstLevel", string.Empty },{"secondLevel", string.Empty } }

I created a new route that match basically everything below /App and routes this to the webform page at /Views/SPAStartPage.aspx. 

At this page you can now get the route values like:

<form id="form1" runat="server">
        Hello SPA world!<br/>
        Querystring parameters:<br/>
        First Level: <%=RouteData.Values["firstLevel"]%><br/>
        Second Level: <%=RouteData.Values["secondLevel"]%><br/>

Hope that gets you started on you SPA :)

Happy coding!

Jul 05, 2016 20:19
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.