Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
November 27, 2021 05:52 am GMT

App secrets in dot net core

Create new application in dotnet core using CLI or Visual Studio IDE
Go to project directory and run below command

dotnet user-secrets initdotnet user-secrets set "Key_name" "key_value"

now get value using
Environment.GetEnvironmentVariable("Key_name");
or
private readonly IConfiguration _config;
public Classtest(IConfiguration config)
{
_config = config;
}

string _key=_config["Key_name"]


Original Link: https://dev.to/kamaleshs48/app-secrets-in-dot-net-core-552g

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To