-
Notifications
You must be signed in to change notification settings - Fork 24
Getting System.NullReferenceException #8
Copy link
Copy link
Open
Description
I'm getting below exception while trying to decrypt the string.
"System.NullReferenceException: Object reference not set to an instance of an object.\r\n at CoreEntities.Classes.Utility.RSADecrypt(String input)\r\n at WebAPI.Attributes.ApiAuthorizeAttribute.Authorize(HttpActionContext actionContext)"
Code:-
public static string RSADecrypt(string input)
{
try
{
string priv = File.ReadAllText(HostingEnvironment.MapPath("~/Certificates/consumer.pem"));
RSACryptoServiceProvider privc = Crypto.DecodeRsaPrivateKey(priv);
return Crypto.DecryptString(input, privc);
}
catch (Exception ex)
{
throw ex;
}
}
It is only coming when i deploy my application on windows server 2012 although it's working fine on local machine on iis and via visual studio 2015.
How to fix this?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels