make a global datetime variable and set it when the user is login successfully and when the user logout get the difference between the current datetime and the variable you set it in the beginning
DateTime loginDate = new DateTime();
double sessionHours = (DateTime.Now - loginDate).TotalHours;
You can check the other data you can retrieve like days , minutes , seconds and etc
Hope i could help