© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
3 replies
uselessxp

❔ WebAPI .NET 7.0 - Encrypt connectionstring in appsettings.json

guys, I'm writing some WebAPI using .NET 7.0, and I'd like to secure the connectionstring with encryption, I found a guide that suggest to do it by using
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe
C:\Windows\Microsoft.NET\Framework\v4.0.30319\aspnet_regiis.exe
is it a good way or is something old?

currently the connectionstring is placed into
appsettings.json
appsettings.json
(not into
web.config
web.config
) and this is its content:
{
  "ConnectionStrings": {
    "Default": "Server=127.0.0.1;Database=mydb;User Id=testuser;Password=testpwd;TrustServerCertificate=true"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}
{
  "ConnectionStrings": {
    "Default": "Server=127.0.0.1;Database=mydb;User Id=testuser;Password=testpwd;TrustServerCertificate=true"
  },
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}
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.json in asp.net core
C#CC# / help
3y ago
❔ Memory leak in a .NET 7 Webapi application
C#CC# / help
3y ago
❔ Accessing StorageConnectionString from AppSettings.json Asp.net core 6.0
C#CC# / help
3y ago
Issues using `.json5` files for `appsettings.json`
C#CC# / help
10mo ago