私は間違った設定を使用していたようです。標準のADを使用する場合は、Windows認証を選択します。
「勤務先または学校のアカウント」は、ADFSの場合のみと考えられます。
アプリケーションが初期化されたら、web.configに移動します。
あなたは私たちが私たちのweb.configファイルにADグループ機能を追加する必要があり、この
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
</system.web>
ようなものが表示されます。これが行われた後、あなたのsystem.webセクションは次のようになります。あなたは今、次のようにあなたのコントローラクラス/アクションメソッドを飾ることができるようになります
<system.web>
<compilation debug="true" targetFramework="4.5.2" />
<httpRuntime targetFramework="4.5.2" />
<authentication mode="Windows" />
<authorization>
<deny users="?" />
</authorization>
<!--NEW-->
<roleManager enabled="true" defaultProvider="AspNetWindowsTokenRoleProvider">
<providers>
<clear />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
<httpModules>
<add name="ApplicationInsightsWebTracking" type="Microsoft.ApplicationInsights.Web.ApplicationInsightsHttpModule, Microsoft.AI.Web" />
</httpModules>
</system.web>
:
[承認(ロール= @ "ユーザーのドメインを\いくつかのADグループ名 ")]
または通常のコード:
User.IsInRole(@" ユーザーのドメイン\いくつかのADグループ名 "))