Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试将使用 Azure 访问控制服务进行身份验证的选项添加到我的网站,所有功能都可以正常工作,但我想在重定向到 ACS 登录时进行更改,而不是在我的应用程序首次运行时进行更改。有没有办法做到这一点?
非常感谢任何帮助
谢谢。
如果它在您的应用程序首次运行时发生,那么您可能将其设置为拒绝访问主 web.config 中的所有内容。如果是这种情况,您可以将其设置为允许所有内容,然后使用 [Authorize] 属性装饰您想要要求身份验证的控制器。
[Authorize] public class MyController : Controller
您还可以为单个操作设置 [Authorize] 属性。此模式将为您提供更精细的控制权,以便您何时授权。