I found this issue in asp.net core. I have two strings alpha numeric, all upper cases, and no spaces either in the middle or ends.
I am getting one string from appsettings.json
and other assigning locally. When I compare those two strings, the application is showing they are not the same.
string stringFromAppSetting = Configuration.GetValue<string>("AppSettingValue");
string string_Local = "1B4D3A3C8F63DBE";
bool? areTheySame=null;
if (stringFromAppSetting == string_Local )
{
areTheySame = true;
}
else
{
areTheySame = false;
}
I also tried stringFromAppSetting.Equals(string_Local)
. It still shows they are not equal. I used notepad++ to check if they are different but I found that they are same.
Can somebody please suggest the possible cause.