© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•15mo ago•
7 replies
Mihneas22

Get values from appsettings in .NET Core

Hello, I have this function in which I try to get a value from app settings file with the IConfiguration but it seems the method I got to use doesen't exist in this current context. How can I solve?

private readonly IConfiguration _configuration;

public APIKeyValidation(IConfiguration configuration)
{
_configuration = configuration;
}

public bool ValidateKey(string userApiKey)
{
if (userApiKey == null)
return false;

var apiKey = _configuration.GetValue<string>(ApiConstants.ApiKeyName);

if(apiKey == null || userApiKey != apiKey)
return false;
}
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

❔ Access AppSettings from CSHTML in ASP.NET core
C#CC# / help
3y ago
❔ Access AppSettings.json in asp.net core
C#CC# / help
3y ago
❔ Accessing StorageConnectionString from AppSettings.json Asp.net core 6.0
C#CC# / help
3y ago
✅ Accessing the appsettings.json that resides in a ASP.NET Core 6 project from another project
C#CC# / help
3y ago