I have handling the exception in my code as below, but still get error :
catch (Exception e)
{
throw new Exception(e.Message);
}
And here is the error :
An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Exception: Object reference not set to an instance of an object.
If you are handling your exception in this way (only retrowing it) than don’t catch exeptions on this level. Catch Exceptions in the method that’s calling this function (Or where you want to handle your exception) and do your handling/showing the message overthere.
You probably don’t have another try/catch block in the calling method which is causing the unhandled exception.