Web应用程序和ISA身份验证问题

时间:2012-06-12 18:50:33

标签: c# asp.net windows-authentication isa

现在,此代码通过获取经过身份验证的用户(Windows身份验证)来工作。我们正在使用活动目录。但是,如果您不在网络上并尝试登录此特定应用程序,您将被重定向到我们的ISA 2006服务器,然后将登录信息传递到应用程序中(理论上,哈哈)

当我在我的手机上访问这个应用程序超过3g它很慢,但我没有得到一个错误(错误只是一个带有确定按钮的弹出窗口,有时它说错误,有时它没有)。但是,当我使用速度更快的计算机而不是外部时,它确实给了我这个错误。我的同事进行的单元测试显示存在某种递归循环或某种错误。无论何时在网络上登录Web应用程序,它都会毫无问题地获取Windows身份验证并且不会出错。我花了3天时间试图找出我的错误但是找不到它,我希望另外几组眼睛可以帮助我追踪它(我使用的是带有C#的ASP.net 4.0)

public string IdentifyUser()
    {
        string retval = string.Empty;
        try{


               //System.Security.Principal.WindowsPrincipal p = System.Threading.Thread.CurrentPrincipal as System.Security.Principal.WindowsPrincipal;
                //string UserIdentityName = p.Identity.Name;
                string UserIdentityName = Request.ServerVariables["AUTH_USER"];
                //string UserIdentityName = HttpContext.Current.User.Identity.Name.ToString();
                string slash = @"\";
                string Username = UserIdentityName.Substring(UserIdentityName.IndexOf(slash) + 1);
                retval = Data_Access_Layers.SQL.GetUserID(Username);




           }
        catch (Exception ex)
        {
            throw ex;
        }
        return retval;
    }

基本上这会触发,拉出用户名,它会被发送到“GetUserID”,它会查找该用户名并发回附加给该人的用户ID,然后将其发送回主页,并存储在一个javascript变量(用于页面的其他部分)

1 个答案:

答案 0 :(得分:0)

AUTH_USER是空的问题吗?

从网络内外访问应用时,AUTH_TYPE标头的价值是多少?

相关问题