AspNetRoutingFeatureToggle is a feature toggle library based on ASP.Net routing attempting to solve A/B testing with constant URLs.
Currently migrating a legacy ASP.Net application ?
You want to implement A/B testing ?
Maintaining public facing URLs is an explicit requirement ?
Your URLs are already managed by ASP.Net routing ?
If all of the above are true, then you might be interested by this library to succeed your migration path.
Here is how it works:
- Feature toggle is based on a predicate with the RequestContext
- If the toggle returns true then ExperimentalRoute is executed
- Otherwise CurrentRoute is executed
Current implementation supports WebForms and MVC IRouteHandler implementations ; works with anonymous and named routes. A fluent builder helps you configure seamlessly your routes.
var route = FeatureToggleRouteBuilder.WithUrl("homepage")
.WithFeatureToogle((r) => r.HttpContext.Request.IsSecureConnection)
.WithCurrentPageRoute("~/WebForm1.aspx")
.WithExperimentalPageRoute("~/WebForm2.aspx")
.Build();
var route = FeatureToggleRouteBuilder.WithUrl("offers/offer-{title}_{id}")
.WithFeatureToogle((r) => r.HttpContext.Request.IsSecureConnection)
.WithCurrentPageRoute("~/Pages/Offers/Details.aspx", true,
defaults: null,
constraints: new { id = @"\d+" })
.WithExperimentalMvcRoute(
defaults: new { controller = "Offers", action = "Details" },
constraints: new { id = @"\d+" })
.Build();
var route = FeatureToggleRouteBuilder.WithUrl("test")
.WithFeatureToogle((r) => r.HttpContext.Request.IsSecureConnection)
.WithCurrentMvcRoute(new { controller = "Home", action = "Index" })
.WithExperimentalMvcRoute(new { controller = "HomeV2", action = "Index" })
.Build();
var route = FeatureToggleRouteBuilder.WithUrl("offers/offer-{title}_{id}")
.WithFeatureToogle((r) => r.HttpContext.Request.IsSecureConnection)
.WithCurrentMvcRoute(
defaults: new { controller = "Offers", action = "Details" },
constraints: new { id = @"\d+" })
.WithExperimentalPageRoute("~/Pages/Offers/Details.aspx", true,
defaults: null,
constraints: new { id = @"\d+" })
.Build();