An Interest In:
Web News this Week
- April 23, 2024
- April 22, 2024
- April 21, 2024
- April 20, 2024
- April 19, 2024
- April 18, 2024
- April 17, 2024
November 27, 2021 05:52 am GMT
Original Link: https://dev.to/kamaleshs48/app-secrets-in-dot-net-core-552g
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:
Tweet
View Full Article
Dev To
An online community for sharing and discovering great ideas, having debates, and making friendsMore About this Source Visit Dev To