重定向出错401.2未经授权 [英] redirecting on error 401.2 unauthorized

查看:400
本文介绍了重定向出错401.2未经授权的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直想上的错误消息:401.2未经授权重定向:登录失败,服务器配置按如下:

I've been trying to redirect on Error message 401.2.: Unauthorized: Logon failed due to server configuration as per below:

<customErrors defaultRedirect="Error.aspx" mode="On">
      <error statusCode="401" redirect="Unauthorized.aspx" />
    </customErrors>

但它从来没有真正重定向。它仍然显示默认的访问被拒绝页面。
我在做什么错在那里?

But it never actually redirects. It still displays the default Access is denied page. What am I doing wrong there?

推荐答案

添加下面的Global.asax似乎运作得很好:

Adding the below to global.asax seems to be working just fine:

void Application_EndRequest(object sender, EventArgs e)
        {
            if (Response.StatusCode == 401)
                Response.Redirect("Unauthorized.aspx");
        }

这篇关于重定向出错401.2未经授权的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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