static protected SessionStateItem Deserialize(
            Stream stream,
            int lockCookie)
        {
            SessionStateItem item;
            int  timeout;
            bool isCookieless;
            SessionDictionary dict;
            bool hasDict;
            bool hasStaticObjects;
            HttpStaticObjectsCollection col;
            Byte eof;

            BinaryReader reader = new BinaryReader(stream);

            timeout          = reader.ReadInt32();
            isCookieless     = reader.ReadBoolean();
            hasDict          = reader.ReadBoolean();
            hasStaticObjects = reader.ReadBoolean();

            if (hasDict)
            {
                dict = SessionDictionary.Deserialize(reader);
            }
            else
            {
                dict = null;
            }

            if (hasStaticObjects)
            {
                col = HttpStaticObjectsCollection.Deserialize(reader);
            }
            else
            {
                col = null;
            }

            eof = reader.ReadByte();
            Debug.Assert(eof == 0xff);

            item = new SessionStateItem(
                dict, col, timeout, isCookieless, (int)stream.Position,
                false, TimeSpan.Zero, lockCookie);

            return(item);
        }