I wanted to check if User exists or not in the database, and i take a User object and check if it is null or not.But the problem is in my code if user doen't exist in our database it returns following exception,
Object reference not set to an instance of an object.
I know this error happen when there is no such a user in our database.So.. i wanted to know if this user object( i want to return null or not) null or not.
My Part of Code
if(newsManager.GetUserUsingEmail(User.Email).Email != null) //If user doesn't exists this come the above mentioned exception
{
//User Exists
}
else
{
//User Doesn't exists
}
How to solve it ?