locked
enable cors with windows authentication mode RRS feed

  • Question

  • User-1201003476 posted

    getting 401 message when consumed aspx with post method  .Cors and windows authentication enabled

    <?xml version="1.0"?>
    <configuration>
      <system.webServer>
        <cors enabled="true">
          <add origin="*" allowCredentials="true" />
        </cors>
      </system.webServer>
    </configuration>
     
    <system.web>
        <identity impersonate="true"/>
        <authentication mode="Windows"></authentication>
    </system.web>
    Wednesday, August 26, 2020 3:09 PM

All replies

  • User-848649084 posted

    Hi,

    Could you please share which cors verb you are trying? you could try to use the below configuration setting to resolve the issue.

    <system.webServer>
        <handlers>
          <add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModule"
                      resourceType="Unspecified" />
        </handlers>
    
        <aspNetCore processPath="dotnet" arguments=".\WebApiEcho.dll"
                      stdoutLogEnabled="false" stdoutLogFile=".\logs\stdout" />
            <security>
                <authentication>
                    <anonymousAuthentication enabled="true" />
                    <windowsAuthentication enabled="true" />
                </authentication>
    
                <authorization>
                    <remove users="*" roles="" verbs="" />
                    <add accessType="Allow" users="?" verbs="OPTIONS" />
                    <add accessType="Allow" users="" roles="USERS" />
                </authorization>
            </security>
      </system.webServer>

    https://techcommunity.microsoft.com/t5/iis-support-blog/putting-it-all-together-cors-tutorial/ba-p/775331

    Thursday, August 27, 2020 6:31 AM