Ejemplo n.º 1
0
        HttpSessionState SelectSession(string id, bool read_only)
        {
            HttpSessionState session = null;

            using (IDataReader reader = GetReaderWithRetry(id)) {
                if (!reader.Read())
                {
                    return(null);
                }

                SessionDictionary           dict;
                HttpStaticObjectsCollection sobjs;
                int timeout;

                dict  = SessionDictionary.FromByteArray(ReadBytes(reader, reader.FieldCount - 1));
                sobjs = HttpStaticObjectsCollection.FromByteArray(ReadBytes(reader, reader.FieldCount - 2));
                // try to support as many DBs/int types as possible
                timeout = Convert.ToInt32(reader.GetValue(reader.FieldCount - 3));

                session = new HttpSessionState(id, dict, sobjs, timeout, false, config.CookieLess,
                                               SessionStateMode.SQLServer, read_only);
                return(session);
            }
        }