我的IIS是用WINDOWS集成验证的,所以相关的权限根椐用户所用电脑的WINDOSW的密码和用户名来验证。如何才能获取登入进来的用户名和密码,向大家请教!谢谢!

解决方案 »

  1.   

    这样可以知道当前登录用户是哪个,权限是多大.
    没准能解决你的问题也说不定. 不过估计你取到用户名和密码就难了
    AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal);
                    WindowsPrincipal WinPrincipal = (WindowsPrincipal)Thread.CurrentPrincipal;
                    this.txtCurrentPrincipalInfo.Text += "WindowsBuiltInRole.Administrator = ";
                    this.txtCurrentPrincipalInfo.Text += WinPrincipal.IsInRole(WindowsBuiltInRole.Administrator).ToString() + "\r\n";                this.txtCurrentPrincipalInfo.Text += "Identity.IsAuthenticated = ";
                    this.txtCurrentPrincipalInfo.Text += Thread.CurrentPrincipal.Identity.IsAuthenticated.ToString() + "\r\n";
                    this.txtCurrentPrincipalInfo.Text += "Identity.AuthenticationType = ";
                    this.txtCurrentPrincipalInfo.Text += Thread.CurrentPrincipal.Identity.AuthenticationType + "\r\n";
                    this.txtCurrentPrincipalInfo.Text += "Identity.Name = ";
                    this.txtCurrentPrincipalInfo.Text += Thread.CurrentPrincipal.Identity.Name + "\r\n";
      

  2.   

    Environment.UserName;//域用户名
    Environment.UserDomainName;//域名
    Environment.MachineName;//机器名