I have a Login Class which has a function: isCorrect() that takes username and password as two attributes And a asp.net WebService To allow using AJAX.
LoginService.cs
public Login CorrectLogin(string username, string password) 
{   
   Login thisLogin = Login.isCorrect(username, password);
   int thisLoggedinUserID = thisLogin.LoggedinUserID;
   if (thisLoggedinUserID != 0)
   {
      Session["loggedinUser"] = thisLoggedinUserID;
   }
   return thisLogin;
}
When I want to set value of Session["loggedinUser"] = thisLoggedinUserID this error accrues:
Object reference not set to an instance of an object.
I can't understand what is solution.
Web services don't have Session by default. Add an attribute to the WebMethod..
 [WebMethod(EnableSession=true)]
 public Login CurrentLogin .....
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With