title: HttpContext.Current doesn't exist in IIS7 Integrated Mode
body: <p>I just switched from Classic Mode to Integrated Mode and now HttpContext doesn't seem to exist in my ASP.NET application. I can't even add a Watch to HttpContext nor to HttpContext.Current.</p>
  
  <p>I'm using FluorineFX where in the Web.config a HttpModule is defined. Apparently, in IIS7 Integrated Mode, these HttpModules need to be added to the Modules section in System.WebServer. I have done this, but now I'm having this HttpContext problem...</p>
  
  <p>Any idea as why this could happen?</p>
  
  <p>Code is in a simple service class being called by Flex (amf).</p>
  
  <pre><code>if (HttpContext.Current.User.Identity != null)
  {
      ...
  </code></pre>
  
  <p>Web.Config (I don't know how to display this properly in Stack...):</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;configuration&gt;
      &lt;configSections&gt;
          &lt;section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" requirePermission="false"/&gt;
          &lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net"/&gt;
          &lt;section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/&gt;
      &lt;section name="cachingConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Caching.Configuration.CacheManagerSettings, Microsoft.Practices.EnterpriseLibrary.Caching, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&gt;
      &lt;sectionGroup name="fluorinefx"&gt;
        &lt;section name="settings" type="FluorineFx.Configuration.XmlConfigurator, FluorineFx" requirePermission="false"/&gt;
      &lt;/sectionGroup&gt;
      &lt;sectionGroup name="spring"&gt;
              &lt;section name="context" type="Spring.Context.Support.ContextHandler, Spring.Core"/&gt;
          &lt;/sectionGroup&gt;
      &lt;/configSections&gt;
    &lt;cachingConfiguration configSource="WebCachingConfiguration.config"/&gt;
    &lt;dataConfiguration defaultDatabase="ConnectionString"/&gt;
    &lt;spring&gt;
          &lt;context&gt;
        &lt;resource uri="~/spring/Commands.xml"/&gt;
        &lt;resource uri="~/spring/Management.xml"/&gt;
        &lt;resource uri="~/spring/DomainModel.xml"/&gt;
        &lt;resource uri="~/spring/Repositories.xml"/&gt;
        &lt;resource uri="~/spring/Services.xml"/&gt;
              &lt;resource uri="~/spring/MsmqQueues.xml"/&gt;
        &lt;resource uri="~/spring/MsmqMessageQueueTemplates.xml"/&gt;
        &lt;resource uri="~/spring/Jobs.xml"/&gt;
          &lt;/context&gt;
      &lt;/spring&gt;
    &lt;log4net configSource="WebLog4Net.config"/&gt;
      &lt;connectionStrings configSource="WebConnectionString.config"/&gt;
    &lt;appSettings configSource="WebAppSettings.config"/&gt;
    &lt;fluorinefx&gt;
          &lt;settings configSource="WebFluorineFX.settings.config"/&gt;
      &lt;/fluorinefx&gt;
      &lt;system.web&gt;
          &lt;globalization culture="nl-BE"/&gt;
          &lt;customErrors mode="RemoteOnly"/&gt;
          &lt;compilation debug="true"&gt;
              &lt;assemblies&gt;
                  &lt;add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/&gt;
                  &lt;add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt;
                  &lt;add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/&gt;
                  &lt;add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/&gt;
                  &lt;add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/&gt;
                  &lt;add assembly="System.Messaging, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/&gt;&lt;/assemblies&gt;
          &lt;/compilation&gt;
          &lt;authorization&gt;
              &lt;allow users="*"/&gt;
          &lt;/authorization&gt;
          &lt;!-- ignored when anonymous authentication is enabled in IIS --&gt;
          &lt;authentication mode="Windows"/&gt;
          &lt;identity impersonate="false"/&gt;
          &lt;httpRuntime maxRequestLength="100000" executionTimeout="1800"/&gt;
          &lt;caching&gt;
              &lt;outputCache enableOutputCache="true"/&gt;
              &lt;outputCacheSettings&gt;
                  &lt;outputCacheProfiles&gt;
                      &lt;add duration="500000" enabled="true" varyByParam="hashCode;thumb" name="AssetCacheProfile" noStore="false"/&gt;
                  &lt;/outputCacheProfiles&gt;
              &lt;/outputCacheSettings&gt;
          &lt;/caching&gt;
          &lt;pages&gt;
              &lt;controls&gt;
                  &lt;add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt;
                  &lt;add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt;
              &lt;/controls&gt;
          &lt;/pages&gt;
          &lt;sessionState timeout="20"/&gt;
          &lt;/system.web&gt;
      &lt;system.codedom&gt;
          &lt;compilers&gt;
              &lt;compiler language="c#;cs;csharp" extension=".cs" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"&gt;
                  &lt;providerOption name="CompilerVersion" value="v3.5"/&gt;
                  &lt;providerOption name="WarnAsError" value="false"/&gt;
              &lt;/compiler&gt;
          &lt;/compilers&gt;
      &lt;/system.codedom&gt;
    &lt;system.webServer&gt;
      &lt;modules&gt;
        &lt;add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
        &lt;add name="FluorineGateway" type="FluorineFx.FluorineGateway, FluorineFx"/&gt;
      &lt;/modules&gt;
      &lt;handlers&gt;
        &lt;remove name="WebServiceHandlerFactory-Integrated" /&gt;
        &lt;remove name="ScriptHandlerFactory" /&gt;
        &lt;remove name="ScriptHandlerFactoryAppServices" /&gt;
        &lt;remove name="ScriptResource" /&gt;
  
        &lt;add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
                   type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt;
        &lt;add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
                   type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/&gt;
  
        &lt;!-- Edumatic 3 Custom HttpHandlers --&gt;
        &lt;add name="UploadUsers.aspx_*" path="UploadUsers.aspx" verb="*"
                   type="Edu3.Core.HttpHandler.UploadUsersHttpHandler, Edu3.Core"
                   preCondition="integratedMode,runtimeVersionv2.0" /&gt;
        &lt;add name="UploadItems.aspx_*" path="UploadItems.aspx" verb="*"
                   type="Edu3.Core.HttpHandler.UploadItemsHttpHandler, Edu3.Core"
                   preCondition="integratedMode,runtimeVersionv2.0" /&gt;
        &lt;add name="UploadBinaryAssetFile.aspx_*" path="UploadBinaryAssetFile.aspx" verb="*"
                   type="Edu3.Core.HttpHandler.UploadBinaryAssetFileHttpHandler, Edu3.Core"
                   preCondition="integratedMode,runtimeVersionv2.0" /&gt;
        &lt;add name="ExportSession.aspx_*" path="ExportSession.aspx" verb="*"
                   type="Edu3.Core.HttpHandler.ExportSessionHttpHandler, Edu3.Core"
                   preCondition="integratedMode,runtimeVersionv2.0" /&gt;
        &lt;add name="ExportSessions.aspx_*" path="ExportSessions.aspx" verb="*"
                   type="Edu3.Core.HttpHandler.ExportSessionsHttpHandler, Edu3.Core"
                   preCondition="integratedMode,runtimeVersionv2.0" /&gt;
        &lt;add name="ValidateSessions.aspx_*" path="ValidateSessions.aspx" verb="*"
                   type="Edu3.Core.HttpHandler.ValidateSessionsHttpHandler, Edu3.Core"
                   preCondition="integratedMode,runtimeVersionv2.0"/&gt;
  
        &lt;add name="ScriptResource" verb="GET,HEAD" path="ScriptResource.axd" preCondition="integratedMode" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /&gt;
      &lt;/handlers&gt;
      &lt;caching&gt;
        &lt;profiles&gt;
          &lt;add extension=".swf" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="08:00:00" /&gt;
          &lt;add extension=".flv" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="08:00:00" /&gt;
          &lt;add extension=".gif" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="08:00:00" /&gt;
          &lt;add extension=".png" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="08:00:00" /&gt;
          &lt;add extension=".mp3" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="08:00:00" /&gt;
          &lt;add extension=".jpeg" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="08:00:00" /&gt;
          &lt;add extension=".jpg" policy="CacheForTimePeriod" kernelCachePolicy="CacheForTimePeriod" duration="08:00:00" /&gt;
        &lt;/profiles&gt;
      &lt;/caching&gt;
  
      &lt;urlCompression doStaticCompression="true" doDynamicCompression="true" /&gt;
    &lt;/system.webServer&gt;
  
    &lt;!-- ************************************************************************* --&gt;
    &lt;!--                          Runtime Section                                  --&gt;
    &lt;!-- Telerik needs this runtime declaration and maybe some of our custom pages --&gt;
    &lt;!-- ************************************************************************* --&gt;
    &lt;runtime&gt;
      &lt;assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" /&gt;
        &lt;/dependentAssembly&gt;
        &lt;dependentAssembly&gt;
          &lt;assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35" /&gt;
          &lt;bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0" /&gt;
        &lt;/dependentAssembly&gt;
      &lt;/assemblyBinding&gt;
    &lt;/runtime&gt;
  &lt;/configuration&gt;
  </code></pre>