when trying to run my API I am getting this error:
Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 's') at System.ArgumentNullException.Throw(String paramName) at System.Text.Encoding.GetBytes(String s) at Program.$(String[] args) in C:\Users\ramit\OneDrive\Documents\GitHub\Photos\HSPA2024\WebAPI\Program.cs:line 24
in my program.cs I have the below code in lines 23,24:
var secretKey = builder.Configuration.GetSection("AppSettings:Key").Value;
var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(secretKey));
and in appsettings:
"AppSettings": {
"Key": "this is my top secret"}
What is the error suggests? What is (Parameter 's')?