I have an asp.net mvc4 application in which i have this snippet:
public bool Logout() {
try {
session["user"] = null;
return true;
}
catch {
return false;
}
}
when i put this code in a controller it's works but if i put it in a model class it didn't.
the problem is in the session["user"] = null; .
So how can i manage the session's variables in a model class?