Posts

Showing posts with the label dotnetcore

Protecting sensitive data using Secret Manager in .Net Core

Image
Accidentally pushing sensitive data stored in application config into source controls!!! Thankfully this happens to many not only you 😜. It feels good when you have company doing mistakes or anything else. So here is how make sure this does not happen again. There are  multiple ways  to protect, the one we will learn now is using Secret Manager tool in #dotnetcore. All we have to do use  dotnet user-secrets  this command. Before using it remove the sensitive value of the property you are trying to hide. In my case it is  "TwilioAuthToken":""  in  appsettings.json  file. Now in the terminal run this below command, dotnet add package Microsoft.Extensions.SecretManager.Tools We have the necessary tools required to run the commands on  user-secrets . Lets create a key value vault for our project in * .csproj  file like this <PropertyGroup> <UserSecretsId>LocalKeyVault</UserSecretsId> </PropertyGroup> Once you have a vau

Launch .Net Core with VSCode for starters

Image
To use VSCode for .net core you would need Omnisharp extension so that we can debug our application just like as in Visual Studio. -- Photo by  SpaceX  on  Unsplash Using the dotnet new command we create a web and an API project dotnet new webapp appname.web dotnet new webapi appname.api Create a solution so that it wraps all the projects in one place dotnet new sln appname dotnet sln add appname.web appname.api After building the Web and the API projects we need to create the launch.json which VScode refers to build and debug the application. For a complete reference on doing these projects consider this great resource . You can always use VSCode terminal to run these above commands as well, also note you can open multiple terminals the same VSCode instance like this . Setup the launch.json by clicking on add configuration and select .Net core web app. we will need to add two such configurations one for web and another for web api. For web api yo