【发布时间】:2025-11-29 19:50:01
【问题描述】:
对于我的 ASP.NET MVC 应用程序,我使用的是 ADFS 身份验证。它是按以下方式设置的
app.UseWsFederationAuthentication(
new WsFederationAuthenticationOptions
{
MetadataAddress = ConfigurationManager.AppSettings.Get("MetadataAddress"),
Wtrealm = ConfigurationManager.AppSettings.Get("Realm"),
});
由于我无法控制,有时 MetadataAddress 上的元数据无法访问。在这种情况下,我想将用户重定向到自定义视图而不是默认错误视图。如何做到这一点?
【问题讨论】:
-
在这种情况下,您也许可以检查是否缺少 MetadataAddress 并重定向用户。这看起来可能是一个类似的问题...github.com/aspnet/Security/issues/1175
-
@MarileeTurscak-MSFT 虽然该链接没有我正在寻找的解决方案,但它确实让我的创意源源不断地涌现,导致了下面的解决方案。谢谢!
-
没问题!您能否在下面将该解决方案标记为答案以帮助其他人更轻松地找到它?
-
@MarileeTurscak-MSFT 最早只能在明天 :)
标签: c# asp.net asp.net-mvc owin adfs