AI OnAI Off
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) { base.RegisterRoutes(routes); routes.MapPageRoute( "SPARoute", "App/{firstLevel}/{secondLevel}", "~/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"> <div> Hello SPA world!<br/> Querystring parameters:<br/> First Level: <%=RouteData.Values["firstLevel"]%><br/> Second Level: <%=RouteData.Values["secondLevel"]%><br/> </div> </form>
Hope that gets you started on you SPA :)
Happy coding!
I have an existing website - a WebForms project - that hooks into EPiServer. Call it www.example.com.
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 www.example.com/app - using a new WebForms page/code-behind and (important!) will not result in 404 from EPi.
In fact, I would like EPi to ignore www.example.com/app 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
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, www.example.com/app 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.