public void CheckSessionTimeout(Session session) { TimeSpan ts = DateTime.Now - session.Time; if (ts.TotalSeconds > _timeout) { _sessions.RemoveAll(s => s.SessionId == session.SessionId); var noActive = new NoActiveSession { Message = string.Format("Your session has expired.") }; throw new FaultException<NoActiveSession>(noActive); } var dt = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second); session.Time = dt; }