IIS - Turning on Basic authentication causes Login

2019-05-11 14:28发布

问题:

After enabling Basic Authentication on an IIS site, I try to access to the site. It doesn't show the login form, but redirect me to somewhere else with a long link that I can't figure it out.

http:// my domain/Login/Login/Login?ReturnUrl=%2FLogin%2FLogin%2FLogin%3FReturnUrl%3D%252FLogin%252FLogin%252FLogin%253FReturnUrl%253D%25252FLogin%25252FLogin%25252FLogin%25253FReturnUrl%25253D%2525252FLogin%2525252FLogin%2525252FLogin%2525253FReturnUrl%2525253D%252525252FLogin%252525252FLogin%252525252FLogin%252525253FReturnUrl%252525253D%25252525252FLogin%25252525252FLogin%25252525252FLogin%25252525253FReturnUrl%25252525253D%2525252525252FLogin%2525252525252FLogin%2525252525252FLogin%2525252525253FReturnUrl%2525252525253D%252525252525252FLogin%252525252525252FLogin%252525252525252FLogin%252525252525253FReturnUrl%252525252525253D%25252525252525252FLogin%25252525252525252FLogin%25252525252525252FLogin%25252525252525253FReturnUrl%25252525252525253D%2525252525252525252FLogin%2525252525252525252FLogin%2525252525252525252FLogin%2525252525252525253FReturnUrl%2525252525252525253D%252525252525252525252FLogin%252525252525252525252FLogin%252525252525252525252FLogin%252525252525252525253FReturnUrl%252525252525252525253D%25252525252525252525252FLogin%25252525252525252525252FLogin%25252525252525252525252FLogin%25252525252525252525253FReturnUrl%25252525252525252525253D%2525252525252525252525252FLogin%2525252525252525252525252FLogin%2525252525252525252525252FLogin%2525252525252525252525253FReturnUrl%2525252525252525252525253D%252525252525252525252525252FLogin%252525252525252525252525252FLogin%252525252525252525252525252FLogin%252525252525252525252525253FReturnUrl%252525252525252525252525253D%25252525252525252525252525252FLogin%25252525252525252525252525252FLogin%25252525252525252525252525252FLogin%25252525252525252525252525253FReturnUrl%25252525252525252525252525253D%2525252525252525252525252525252FLogin%2525252525252525252525252525252FLogin%2525252525252525252525252525252FLogin%2525252525252525252525252525253FReturnUrl%2525252525252525252525252525253D%252525252525252525252525252525252FLogin%252525252525252525252525252525252FLogin%252525252525252525252525252525252FLogin%252525252525252525252525252525253FReturnUrl%252525252525252525252525252525253D%25252525252525252525252525252525252Fadmin

<?xml version="1.0" encoding="utf-8"?>
<!--
    For more information on how to configure your ASP.NET application, please visit
    http://go.microsoft.com/fwlink/?LinkId=301880
    -->
<configuration>
    <configSections>
        <!-- For more information on Entity Framework configuration, visit http://go.microsoft.com/fwlink/?LinkID=237468 -->
        <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
    </configSections>

    <appSettings>
        <!-- Required by Microsoft ReportViewer control -->
        <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="recaptchaPublicKey" value="6LeN_vUSAAAAAM5eeRSrzyi4ThIoe6dX5fskng9T" />
        <add key="recaptchaPrivateKey" value="6LeN_vUSAAAAAMGpwlapQ-ZNmswHmrI8ImjSUiPL" />

    <add key="MvcReportViewer.AspxViewer" value="/MvcReportViewer.aspx" />
    <add key="MvcReportViewer.ReportServerUrl" value="http://localhost/ReportServer" />
    <add key="MvcReportViewer.Username" value="" />
    <add key="MvcReportViewer.Password" value="" />
    <add key="MvcReportViewer.IsAzureSSRS" value="false" />
      <add key="MvcReportViewer.AspxViewer" value="/MvcReportViewer.aspx" />
    <add key="MvcReportViewer.ReportServerUrl" value="http://localhost/ReportServer" />
    <add key="MvcReportViewer.Username" value="" />
    <add key="MvcReportViewer.Password" value="" />
  </appSettings>
    <system.web>
        <globalization culture="nb-NO" />
        <pages>
            <namespaces>
            </namespaces>
        </pages>
        <authentication mode="Windows" />
        <compilation debug="true" targetFramework="4.5" />
        <httpRuntime targetFramework="4.5" />
        <hostingEnvironment shadowCopyBinAssemblies="false" />
      <httpHandlers>
       <!--Required by Microsoft ReportViewer control--> 
      <!--<add path="Reserved.ReportViewerWebControl.axd" verb="*" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" validate="false" />-->
    </httpHandlers>
        <identity impersonate="false" />
  </system.web>
    <system.webServer>
        <modules>
            <remove name="FormsAuthenticationModule" />
        </modules>
    <httpErrors existingResponse="PassThrough"></httpErrors>
    <handlers>
       <!--required by microsoft reportviewer control-->
    <remove name="ReportViewerWebControlHandler" />
    <add name="ReportViewerWebControlHandler" preCondition="integratedMode" verb="*" path="Reserved.ReportViewerWebControl.axd" type="Microsoft.Reporting.WebForms.HttpHandler, Microsoft.ReportViewer.WebForms, Version=11.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
    </handlers>
  </system.webServer>
    <runtime>
        <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
            <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.Mvc" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-5.1.0.0" newVersion="5.1.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.Optimization" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-3.0.0.0" newVersion="3.0.0.0" />
            </dependentAssembly>
            <dependentAssembly>
                <assemblyIdentity name="WebGrease" publicKeyToken="31bf3856ad364e35" />
                <bindingRedirect oldVersion="0.0.0.0-1.5.2.14234" newVersion="1.5.2.14234" />
            </dependentAssembly>
        </assemblyBinding>
    </runtime>
    <entityFramework>
        <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">
            <parameters>
                <parameter value="v11.0" />
            </parameters>
        </defaultConnectionFactory>
        <providers>
            <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
        </providers>
    </entityFramework>
</configuration>

回答1:

Your login page is not configured to allow anonymous access. Thus, an unauthenticated user can't reach the login page and you get this redirect recursion.



标签: asp.net iis-7