WIF-ADFS句柄401:未经授权 [英] WIF - ADFS handle 401 : Unauthorized

查看:167
本文介绍了WIF-ADFS句柄401:未经授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,专家

在我的Web应用程序中,我已将我的Web应用程序与WIF和ADFS服务器集成在一起,以实现单点登录目的.
我的应用程序托管在WIF服务器上,当我点击我的应用程序时,它将重定向到ADFS服务器以进行用户身份验证.并且ADFS服务器将使用Active Directory对用户进行身份验证.

但是,当某些用户从域外访问该站点时,ADFS服务器将无法对该用户进行身份验证,因此它将用户重定向到:401-未经授权的页面.

因此,我希望将用户重定向到应用程序的其他页面,而不是401:未经授权的页面,并使用我的数据库对用户进行身份验证,如果通过身份验证,则希望对该用户执行单点登录".

那么如何实现呢?

Hi Experts,

In my web application, i have integrated my web application with WIF and ADFS server for the single sign on purpose.
My application is hosted on WIF server and when i hit to my application it will redirect to ADFS server for the user authentication. And ADFS server will authenticate user using Active Directory.

But when some user from out of the domain access the site than ADFS server will not authenticate user so it will redirect user to : 401 - Unauthorized page.

So instead of 401 : Unauthorized page i want to redirect user to some other page of my application and authenticate user using my database and if authenticated then i want to perform Single Sign On for that user.

So how could it be implemented ?

推荐答案

您可以使用Web.Config配置来处理它.

在您的web.config中添加类似的内容:
You can handle it using Web.Config configuration.

Add something like this in your web.config:
<customErrors mode="On" defaultRedirect="~/Login">
     <error statusCode="401" redirect="~/Unauthorized" />
</customErrors>


这会将用户定向到未经授权"页面.您可以在此页面中输入您的逻辑.

此处的详细信息: MSDN:customErrors元素(ASP.NET设置架构) [绕过ASP.NET未经授权的重定向到登录页面 [ ^ ]


This will direct user to ''Unauthorized'' page. You can put your logic in this page.

Detail here: MSDN: customErrors Element (ASP.NET Settings Schema)[^]

Other way, look here:
Bypass ASP.NET unauthorized redirect to a login page[^]


这篇关于WIF-ADFS句柄401:未经授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆