If I have a simple Default.aspx WebForms page under Views/WebForms/Default.aspx, how do I configure the MVC routing to open the Default.aspx page at startup?
I've tried reading some articles regarding the MVC 6 routing, but I don't think they're mentioning anything about incorporating WebForms routing with the new MVC 6. (I know WebForms is kind of deprecated but still supported in ASP.NET 5)
Articles:
- http://stephenwalther.com/archive/2015/02/07/asp-net-5-deep-dive-routing
- http://www.strathweb.com/2015/01/asp-net-mvc-6-attribute-routing-controller-action-tokens/
I think I have to use the IApplicationBuilder.UseRouter method, but not sure how to accomplish that.
Here's what I have attempted:
RouteCollection routes = new RouteCollection();
routes.Add(new TemplateRoute(new WebFormsRouterHandler(), "test", null));
app.UseRouter(routes);
And here's the WebFormsRouterHandler:
public class WebFormsRouterHandler : IRouter
{
public string GetVirtualPath(VirtualPathContext context)
{
throw new NotImplementedException();
}
public Task RouteAsync(RouteContext context)
{
}
}
I'm not sure what to put in RouteAsync method..return the WebForms perhaps?