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 init
dotnet user-secrets set “Key_name” “key_value”

now get value using
Environment.GetEnvironmentVariable…


This content originally appeared on DEV Community and was authored by Kamlesh Singh

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

dotnet user-secrets init
dotnet 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"]


This content originally appeared on DEV Community and was authored by Kamlesh Singh


Print Share Comment Cite Upload Translate Updates
APA

Kamlesh Singh | Sciencx (2021-11-27T05:52:30+00:00) App secrets in dot net core. Retrieved from https://www.scien.cx/2021/11/27/app-secrets-in-dot-net-core/

MLA
" » App secrets in dot net core." Kamlesh Singh | Sciencx - Saturday November 27, 2021, https://www.scien.cx/2021/11/27/app-secrets-in-dot-net-core/
HARVARD
Kamlesh Singh | Sciencx Saturday November 27, 2021 » App secrets in dot net core., viewed ,<https://www.scien.cx/2021/11/27/app-secrets-in-dot-net-core/>
VANCOUVER
Kamlesh Singh | Sciencx - » App secrets in dot net core. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2021/11/27/app-secrets-in-dot-net-core/
CHICAGO
" » App secrets in dot net core." Kamlesh Singh | Sciencx - Accessed . https://www.scien.cx/2021/11/27/app-secrets-in-dot-net-core/
IEEE
" » App secrets in dot net core." Kamlesh Singh | Sciencx [Online]. Available: https://www.scien.cx/2021/11/27/app-secrets-in-dot-net-core/. [Accessed: ]
rf:citation
» App secrets in dot net core | Kamlesh Singh | Sciencx | https://www.scien.cx/2021/11/27/app-secrets-in-dot-net-core/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.