I am using the below sample function in wcf project. It's working fine internally. When i am calling this function from outside of the hosted service. It returns the error.
Object reference not set to be an instance of an object.
I find that line HttpContext.Current.Session["UserSession"] // Error Code
try
{
    if (HttpContext.Current.Session["UserSession"] != null)
    {
    }
    else
    {
    }
}
catch(Exception ex)
{
    return ex.Message;
}
But i want to user the session variable. Please help me to solve this.
 
     
     
    