enable cors with windows authentication modeRSS

1 reply

Last post Aug 27, 2020 06:31 AM by Jalpa Panchal

  • enable cors with windows authentication mode

    Aug 26, 2020 03:09 PM|sivagate|LINK

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

    <div> <div><?xml version="1.0"?>
    <configuration>
      <system.webServer>
        <cors enabled="true">
          <add origin="*" allowCredentials="true" />
        </cors>
      </system.webServer>
    </configuration></div> <div> <div> </div> <div> <div><system.web>
        <identity impersonate="true"/>
        <authentication mode="Windows"></authentication>
    </system.web></div> </div> </div> </div>
  • Re: enable cors with windows authentication mode

    Aug 27, 2020 06:31 AM|Jalpa Panchal|LINK

    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

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.