This sample demonstrates how to use the OpenFeature .NET Web Application. It includes a simple .NET 9 web application that retrieves and evaluates feature flags using the OpenFeature client. The sample is set up with the InMemoryProvider and a relatively simple boolean welcome-message feature flag.
The sample can easily be extended with alternative providers, which you can find in the dotnet-sdk-contrib repository.
- .NET 9 SDK installed on your machine.
-
Clone the repository:
git clone https://github.com/open-feature/dotnet-sdk.git openfeature-dotnet-sdk
-
Navigate to the Web sample project directory:
cd openfeature-dotnet-sdk/samples/AspNetCore -
Run the following command to start the application:
dotnet run
-
Open your web browser and navigate to
http://localhost:5412/welcometo see the application in action.
You can enable OpenFeature debug logging by setting the Logging:LogLevel:OpenFeature.* setting in appsettings.Development.json to Debug. This will provide detailed logs of the OpenFeature SDK's operations, which can be helpful for troubleshooting and understanding how feature flags are being evaluated.