Esempio n. 1
0
        private void UpdateFromDependencies(HttpResponse response)
        {
            CacheDependency dep = null;

            if ((this._etag == null) && this._generateEtagFromFiles)
            {
                dep = response.CreateCacheDependencyForResponse();
                if (dep == null)
                {
                    return;
                }
                string uniqueID = dep.GetUniqueID();
                if (uniqueID == null)
                {
                    throw new HttpException(System.Web.SR.GetString("No_UniqueId_Cache_Dependency"));
                }
                DateTime      time    = this.UpdateLastModifiedTimeFromDependency(dep);
                StringBuilder builder = new StringBuilder(0x100);
                builder.Append(HttpRuntime.AppDomainIdInternal);
                builder.Append(uniqueID);
                builder.Append("+LM");
                builder.Append(time.Ticks.ToString(CultureInfo.InvariantCulture));
                this._etag = MachineKeySection.HashAndBase64EncodeString(builder.ToString());
                this._etag = "\"" + this._etag + "\"";
            }
            if (this._generateLastModifiedFromFiles)
            {
                if (dep == null)
                {
                    dep = response.CreateCacheDependencyForResponse();
                    if (dep == null)
                    {
                        return;
                    }
                }
                DateTime utcDate = this.UpdateLastModifiedTimeFromDependency(dep);
                this.UtcSetLastModified(utcDate);
            }
        }
Esempio n. 2
0
        private void OneTimeInit()
        {
            SessionStateSection sessionState = RuntimeConfig.GetAppConfig().SessionState;

            s_configPartitionResolverType           = sessionState.PartitionResolverType;
            s_configStateConnectionString           = sessionState.StateConnectionString;
            s_configStateConnectionStringFileName   = sessionState.ElementInformation.Properties["stateConnectionString"].Source;
            s_configStateConnectionStringLineNumber = sessionState.ElementInformation.Properties["stateConnectionString"].LineNumber;
            s_configCompressionEnabled = sessionState.CompressionEnabled;
            if (this._partitionResolver == null)
            {
                string stateConnectionString = sessionState.StateConnectionString;
                SessionStateModule.ReadConnectionString(sessionState, ref stateConnectionString, "stateConnectionString");
                s_singlePartitionInfo = (StateServerPartitionInfo)this.CreatePartitionInfo(stateConnectionString);
            }
            else
            {
                s_usePartition     = true;
                s_partitionManager = new PartitionManager(new System.Web.CreatePartitionInfo(this.CreatePartitionInfo));
            }
            s_networkTimeout = (int)sessionState.StateNetworkTimeout.TotalSeconds;
            string appDomainAppIdInternal = HttpRuntime.AppDomainAppIdInternal;
            string str3 = MachineKeySection.HashAndBase64EncodeString(appDomainAppIdInternal);

            if (appDomainAppIdInternal.StartsWith("/", StringComparison.Ordinal))
            {
                s_uribase = appDomainAppIdInternal + "(" + str3 + ")/";
            }
            else
            {
                s_uribase = "/" + appDomainAppIdInternal + "(" + str3 + ")/";
            }
            s_onAppDomainUnload = new EventHandler(this.OnAppDomainUnload);
            Thread.GetDomain().DomainUnload += s_onAppDomainUnload;
            s_oneTimeInited = true;
        }