Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To use feature flags in ASP.NET Core, install Microsoft.FeatureManagement.AspNetCore, register feature management, define named flags in configuration, and evaluate them with a feature gate or IFeatureManager. You can start with appsettings.json; Azure App Configuration is optional when you need centralized flag management and provider-based refresh.

How feature flags work in ASP.NET Core

A feature flag is a named configuration setting that controls whether an application feature is available. Feature management is built on .NET’s IConfiguration, so flags can come from appsettings.json or another configuration provider. Microsoft describes the practice as decoupling feature release from code deployment, allowing availability to be changed without changing the application code.

A basic flag is either enabled or disabled. Optional feature filters make its state conditional—for example, on a percentage rollout, a time window, or a user/group targeting rule. You do not need Azure to use flags; Azure App Configuration is one option for centrally managing them.

Add a basic feature flag

  1. Install the ASP.NET Core integration. Add the Microsoft.FeatureManagement.AspNetCore package to the project. Microsoft documents the package and integration points in its ASP.NET Core feature-flag quickstart.
  2. Register feature management. In the application’s service-registration setup, add services.AddFeatureManagement(); (or the equivalent service registration for the hosting style used by the app). This makes the feature-management services available through dependency injection.
  3. Define the flag in configuration. Microsoft’s documented JSON format uses a feature_management section with a feature_flags array. For example:
    {
      "feature_management": {
        "feature_flags": [
          {
            "id": "Beta",
            "enabled": true
          }
        ]
      }
    }

    A flag enabled without conditions is on. Keep the identifier, such as Beta, consistent wherever the flag is referenced.

  4. Choose where to enforce it. Use a feature gate to protect a web surface, or inject IFeatureManager and check the flag in application logic when only part of a workflow should change.
  5. Register any configured filters. If a flag names a feature filter, ensure the corresponding filter is registered and its alias matches the configuration. Evaluation throws if a configured filter is missing, unless the application opts to ignore missing filters.

Microsoft’s .NET feature management reference documents the JSON schema and evaluation behavior. Configuration-provider conventions can determine how configuration is loaded and overridden; verify the effective flag state in the environment where the app runs.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Choose a feature gate or an in-code check

Gate an entire page, route, or action

ASP.NET Core integration supports feature gates for MVC controller actions, Razor Pages, views, routes, and middleware. A gate prevents the protected endpoint or page from running while its flag is off. Microsoft’s Razor Pages quickstart, for example, decorates a page with [FeatureGate("Beta")].

Use a gate when the whole surface should be unavailable unless the flag is on. Consider what users should see when access is blocked, and ensure navigation or links do not imply that the gated feature is available.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Branch within application logic

Inject IFeatureManager and evaluate the named flag when a smaller section of a handler, service, or view model needs conditional behavior. This keeps the route available while allowing only the relevant operation or presentation to vary. Prefer one clearly scoped check over scattering unrelated flag checks throughout the code.

Use filters for staged activation

Feature filters determine when a flag is on. Microsoft documents percentage, time-window, and targeting filters. They let a team make availability conditional rather than treating every flag as a permanent all-or-nothing switch.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
  • Percentage: expose a feature to a configured share of users for a staged rollout.
  • Time window: activate a feature during a configured schedule.
  • Targeting: select users or groups, such as internal testers or a named audience.

When a flag has multiple filters, the requirement controls how results combine: Any means at least one filter must return true; All means every filter must return true. Microsoft’s documented default requirement when conditions are present is Any. That filter-combination rule is distinct from the percentage or audience settings inside a targeting rule.

Target users and groups correctly

Targeting needs identity and group information at evaluation time. The ASP.NET Core integration provides a default ITargetingContextAccessor that reads targeting details from HttpContext.User, including the identity name and role claims. If your application represents audiences differently, implement a custom accessor and register it so targeting evaluates the context your rules expect.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

Check that authenticated identities have stable identifiers suitable for targeting; a missing or changing identity can make audience assignment unreliable. In a targeting filter, exclusions take precedence over the rest of the targeting configuration. See Microsoft’s targeting filter reference for the documented behavior.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use Azure App Configuration when flags need central management

Keep flags in local or deployment-provided configuration when that operating model is sufficient. Choose Azure App Configuration when a team needs a centralized place to manage flags and change availability without changing and redeploying the application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

For the ASP.NET Core targeting walkthrough, Microsoft uses Microsoft.Azure.AppConfiguration.AspNetCore alongside Microsoft.FeatureManagement.AspNetCore, connects to the App Configuration store, calls UseFeatureFlags(), registers feature management, and adds UseAzureAppConfiguration() middleware to enable refresh. The walkthrough recommends Microsoft Entra ID authentication with DefaultAzureCredential; it also demonstrates a connection-string option. Keep credentials out of source code and use an authentication approach suitable for the deployment environment. Follow the ASP.NET Core walkthrough for the setup details.

The .NET configuration provider requires explicitly loading flags with UseFeatureFlags(). Its documented default refresh interval is 30 seconds, configurable with SetRefreshInterval; selection can also be scoped by key, label, and tag. This is provider refresh behavior, not a promise that every running app observes a change immediately. Review Microsoft’s provider refresh documentation when setting expectations for propagation.

When to use variants and telemetry

A binary flag is appropriate when the choice is simply whether a feature is enabled. Use variants when different segments should receive different feature configurations; a variant can hold a string, number, Boolean, or configuration object. Feature-management telemetry can emit evaluation information for analysis.

Variants and telemetry do not establish that one version performs better. A useful experiment still needs a defined hypothesis, relevant outcome measures, and enough observations to support a conclusion. Microsoft’s feature management overview describes feature flags, variants, and telemetry.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Practical operating checks

  • Use stable, descriptive flag identifiers and keep references aligned across configuration and code.
  • Check that all filter aliases referenced by configuration have registered implementations.
  • Decide which application boundary should be gated, and separately consider whether the interface communicates the feature’s availability clearly.
  • For targeting, verify which identity and group claims the accessor supplies and whether they match the targeting rules.
  • For remote configuration, test the refresh path and plan for its configured interval rather than assuming an instant update.
  • Remove or retire temporary rollout flags when they are no longer needed, so old branches do not become permanent complexity.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.