Quantcast
Channel: Internet Explorer Web Development forum
Viewing all articles
Browse latest Browse all 3527

ASP.Net MVC IIS Windows Authentication Issue

$
0
0

I understand that this is probably not the best forum to ask this in but there were no other logical choices to choose from.

Have a strange situation. We have an MVC application setup on Windows 2008 Server IIS 7 configured for Windows Authentication. When we restart the computer there is about a two hour delay before the users are recognized/authenticated to the site. The server is part of an AD domain and after the 2 hour delay all works as expected. Until the delay is finished the users are presented with browser login prompt no matter if they are in office and logged into their network or outside the network. The login prompt just keeps popping up even after they enter their credentials over and over and over. FailedRequestLog shows no errors but shows status code of 401.1.

We think it has something to do with our site configuration or code because I can create a folder and drop a basic default.aspx page and basic web.config file in that folder then point the IIS entry to it and it serves it up as expect right away. When we re-point the IIS entry back to the originial folder the site then recognizes the users credentials.

Any help is greatly appreciated.

Here is our web.config

<configuration>
  <configSections>
    <section name="dataCache" type="KAF.Cache.Providers.DataCacheSection" allowLocation="false" allowDefinition="MachineToApplication"/>
    <section name="dataAccess" type="KAF.DAL.Providers.DataAccessSection" allowLocation="false" allowDefinition="MachineToApplication"/>
    <section name="siteMonitor" type="KAF.Monitor.MonitorSection" allowLocation="false" allowDefinition="MachineToApplication"/>
    <sectionGroup name="system.web.webPages.razor"
      type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
      <section name="host"
        type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        requirePermission="false"/>
      <section name="pages"
        type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"
        requirePermission="false"/>
    </sectionGroup>
    <section name="entityFramework"
      type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
      requirePermission="false"/>
  </configSections>
  <appSettings>
    <add key="webpages:Version" value="3.0.0.0"/>
    <add key="webpages:Enabled" value="false"/>
    <add key="ClientValidationEnabled" value="true"/>
    <add key="UnobtrusiveJavaScriptEnabled" value="true"/>
    <add key="DisplayCodeExectionTimeGrid" value="true"/>
    <add key="EnableHttpRequestAuditing" value="false"/>
    <add key="EnableActionAuditing" value="false"/>
    <add key="EnableTracing" value="false"/>
    <add key="RouteDebugger:Enabled" value="true"/>
    <add key="KAFWindowsAuthDomain" value="{DOMAIN VALUE}" />
  </appSettings>
  <connectionStrings>
    <remove name="LocalSqlServer"/>
    <add name="DefaultConnection" connectionString="" providerName="System.Data.SqlClient"/>
  </connectionStrings>
  <dataCache defaultProviderName="Default">
    <providers>
      <add name="Default" type="KAF.Cache.Providers.DefaultCacheProvider, KAF.Cache.Providers"/>
    </providers>
  </dataCache>
  <dataAccess defaultProviderName="SqlClient">
    <providers>
      <add connectionStringName="DefaultConnection" name="SqlClient" type="KAF.DAL.Providers.Database.SqlClientProvider, KAF.DAL.Providers.Database"/>
    </providers>
  </dataAccess>
  <siteMonitor defaultProviderName="Default">
    <providers>
      <add name="Default" type="KAF.Monitor.Providers.DefaultMonitorProvider, KAF.Monitor"/>
    </providers>
  </siteMonitor>
  <system.web>
    <healthMonitoring enabled="true">
      <rules>
        <add name="Application Lifetime Events Default" eventName="Application Lifetime Events" provider="EventLogProvider" profile="Default" minInstances="1"
          maxLimit="Infinite" minInterval="00:01:00" custom=""/>
      </rules>
    </healthMonitoring>
    <authentication mode="Windows" />
    <authorization>
      <allow users="*"/>
    </authorization>
    <globalization fileEncoding="utf-8" requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" uiCulture="en-US"/>
    <compilation debug="true" targetFramework="4.5"/>
    <httpRuntime targetFramework="4.5" executionTimeout="1200" maxRequestLength="102400" requestValidationMode="2.0"/>
    <customErrors mode="On" redirectMode="ResponseRewrite" defaultRedirect="/error">
      <error statusCode="404" redirect="/pagenotfound"/>
      <error statusCode="401" redirect="/unauthorized"/>
      <error statusCode="402" redirect="/pagenotfound"/>
      <error statusCode="403" redirect="/pagenotfound"/>
      <error statusCode="500" redirect="/error"/>
      <error statusCode="501" redirect="/error"/>
      <error statusCode="502" redirect="/error"/>
      <error statusCode="503" redirect="/error"/>
    </customErrors>
    <membership defaultProvider="KafMembershipProvider">
      <providers>
        <remove name="AspNetSqlMembershipProvider"/>
        <add connectionStringName="DefaultConnection" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false"
          requiresUniqueEmail="true" maxInvalidPasswordAttempts="10" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0"
          passwordAttemptWindow="10" passwordFormat="Hashed" applicationName="/" name="KafMembershipProvider"
          type="Kaf.Mvc.Membership.FormsAuthMembershipProvider, KAF.Mvc"/>
      </providers>
    </membership>
    <roleManager enabled="true" defaultProvider="KafRoleProvider">
      <providers>
        <remove name="AspNetSqlRoleProvider"/>
        <add applicationName="/" connectionStringName="DefaultConnection" name="KafRoleProvider" type="KAF.Mvc.Membership.RolesProvider, KAF.Mvc"/>
      </providers>
    </roleManager>
  </system.web>
  <system.web.webPages.razor>
    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
    <pages pageBaseType="System.Web.Mvc.WebViewPage">
      <namespaces>
        <add namespace="System.Web.Mvc"/>
        <add namespace="System.Web.Mvc.Ajax"/>
        <add namespace="System.Web.Mvc.Html"/>
        <add namespace="System.Web.Optimization"/>
        <add namespace="System.Web.Routing"/>
        <add namespace="KAF.Mvc"/>
        <add namespace="KAF.Extensions"/>
      </namespaces>
    </pages>
  </system.web.webPages.razor>
  <system.webServer>
    <staticContent>
      <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="7.00:00:00"/>
    </staticContent>
    <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" staticCompressionLevel="9"/>
      <dynamicTypes>
        <add mimeType="text/*" enabled="true"/>
        <add mimeType="message/*" enabled="true"/>
        <add mimeType="application/x-javascript" enabled="true"/>
        <add mimeType="application/json" enabled="true"/>
        <add mimeType="*/*" enabled="false"/>
      </dynamicTypes>
      <staticTypes>
        <add mimeType="text/*" enabled="true"/>
        <add mimeType="message/*" enabled="true"/>
        <add mimeType="application/x-javascript" enabled="true"/>
        <add mimeType="application/atom+xml" enabled="true"/>
        <add mimeType="application/xaml+xml" enabled="true"/>
        <add mimeType="*/*" enabled="false"/>
      </staticTypes>
    </httpCompression>
    <urlCompression doStaticCompression="true" doDynamicCompression="false"/>
    <httpErrors>
      <remove statusCode="503" subStatusCode="-1"/>
      <remove statusCode="502" subStatusCode="-1"/>
      <remove statusCode="501" subStatusCode="-1"/>
      <remove statusCode="500" subStatusCode="-1"/>
      <remove statusCode="412" subStatusCode="-1"/>
      <remove statusCode="406" subStatusCode="-1"/>
      <remove statusCode="405" subStatusCode="-1"/>
      <remove statusCode="404" subStatusCode="-1"/>
      <remove statusCode="403" subStatusCode="-1"/>
      <remove statusCode="401" subStatusCode="-1"/>
      <error statusCode="401" prefixLanguageFilePath="" path="/unauthorized" responseMode="ExecuteURL"/>
      <error statusCode="403" prefixLanguageFilePath="" path="/pagenotfound" responseMode="ExecuteURL"/>
      <error statusCode="404" prefixLanguageFilePath="" path="/pagenotfound" responseMode="ExecuteURL"/>
      <error statusCode="405" prefixLanguageFilePath="" path="/pagenotfound" responseMode="ExecuteURL"/>
      <error statusCode="406" prefixLanguageFilePath="" path="/pagenotfound" responseMode="ExecuteURL"/>
      <error statusCode="412" prefixLanguageFilePath="" path="/pagenotfound" responseMode="ExecuteURL"/>
      <error statusCode="500" prefixLanguageFilePath="" path="/error" responseMode="ExecuteURL"/>
      <error statusCode="501" prefixLanguageFilePath="" path="/error" responseMode="ExecuteURL"/>
      <error statusCode="502" prefixLanguageFilePath="" path="/error" responseMode="ExecuteURL"/>
      <error statusCode="503" prefixLanguageFilePath="" path="/error" responseMode="ExecuteURL"/>
    </httpErrors>
    <modules runAllManagedModulesForAllRequests="true" />    
  </system.webServer>
  <runtime>
    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages.Razor" publicKeyToken="31bf3856ad364e35" culture="neutral"/>
        <bindingRedirect oldVersion="0.0.0.0-1.0.0.0" newVersion="1.0.0.0"/>
      </dependentAssembly>una
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Helpers" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-3.0.0.0" newVersion="3.0.0.0"/>
      </dependentAssembly>
      <dependentAssembly>
        <assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
        <bindingRedirect oldVersion="1.0.0.0-5.2.3.0" newVersion="5.2.3.0"/>
      </dependentAssembly>
    </assemblyBinding>
  </runtime>
  <entityFramework>
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
      <parameters>
        <parameter value="mssqllocaldb"/>
      </parameters>
    </defaultConnectionFactory>
    <providers>
      <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"/>
    </providers>
  </entityFramework>
</configuration>



Viewing all articles
Browse latest Browse all 3527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>