如何实现windows 验证不成功后跳转1. web.comfig
  <authentication mode="Windows" /> 
    <authorization>
<deny users="?" />
     
    </authorization>2. Global.asax.csprivate void WindowsAuthentication_Authenticate(Object sender, WindowsAuthenticationEventArgs e)
{

if (e.Identity.IsAuthenticated)
{
Response.Write (e.Identity.Name);
}
else
{
// 这句从未执行
Response.Redirect ("../Extranet"); 
}}
Application_AuthenticateRequest ()
{
if (User.Identity.IsAuthenticated)
{
Response.Write (User.Identity.Name);
}
else
{
// 这句从未执行
Response.Redirect ("../Extranet");
}
}
Application_AuthorizeRequest()
{
//... 同上
}以上写法在验证通不过时(如外部用户登录)都弹出windows登陆对话框, 能否像Forms验证那样,直接跳到别的页面,不要弹出windows登陆对话框呢?Thanks!

解决方案 »

  1.   

    you have to do it on the IIS, see how to configureIIS Custom 401 Errors
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/MixedSecurity.asp
      

  2.   

    通过设置IIS的自定义错误页面来跳转, 的确是很好的方法.不过还有一点问题, 错误页显示前,IE会弹出windows登陆框, 能不能屏蔽掉这个框呢.