似たような質問がたくさんありますが、これは私を困惑させました。
[Authorize] を使用した場合、ユーザー名とパスワードの入力を求められますが、[InternalAuthorizeV2] を使用した場合は入力しません
今のところ特別なことは何もしないカスタム AuthorizeAttribute があります (間違っている可能性があることを制限しています)。
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public class InternalAuthorizeV2Attribute: AuthorizeAttribute
{}
そしてコントローラーのアクション
[InternalAuthorizeV2(Roles = "MobileApps_Parkingggg")]
public ActionResult Index()
{
var model = new VmParking();
return View(model);
}
ログインは別のアプリで処理されますが、同じ Web 構成行があります
<machineKey compatibilityMode="Framework20SP2" validationKey="editedOut" decryptionKey="editedOut" validation="SHA1" decryption="AES"/>
<authentication mode="Forms">
<forms name="emLogin" loginUrl="/Login/Index" timeout="540" protection="All" path="/" enableCrossAppRedirects="true" cookieless="UseCookies" />
</authentication>
<sessionState timeout="540" />
[Authorize] のページに移動してログインし、トラブル ページに戻ると、ユーザー名は表示されますが、顧客属性を呼び出しているようには見えません。
新しい情報: 多くのアプリで使用されているため、私の属性は共有 DLL にあります。csファイルをWebプロジェクトにコピーするとうまくいくようです。理由はわかりませんが、まだヒントやヒントを探しています。