简体   繁体   English

IIS上部署的网站未获得域NT登录

[英]Website deployed on IIS not getting the domain NT login

I deployed my ASP.net Website on a server using IIS. 我使用IIS在服务器上部署了ASP.net网站。 The problem is that it denies Access to anyone accessing the website on the same domain. 问题在于,它拒绝访问同一域中的网站的任何人。 What i do is once a user tries to Access the website on the server i read the NT login for the user and match it to NT logins present in my Db and give the person Access if he his/her NT login is present in the DB. 我要做的是,一旦用户尝试访问服务器上的网站,我就会读取该用户的NT登录名,并将其与我的Db中存在的NT登录名相匹配,并且如果该人的NT登录名存在于数据库中,则将其授予访问权限。 Now After Debugging i checked the variable used which stores the User NT login before checking it with the DB, and no matter who access the website the Login passed is the one for the server on which the website is deployed. 现在,在调试之后,我先检查了用于存储User NT登录名的变量,然后再与数据库进行了检查,无论谁访问该网站,传递的登录名都是用于部署该网站的服务器的登录名。

Webcofig: Webcofig:

<?xml version="1.0" encoding="UTF-8"?>
  <configuration>
    <system.web>
       <identity impersonate="true" />
   </system.web>
   <system.webServer>
      <defaultDocument>
          <files>
              <add value="User_login_Portal.aspx" />
          </files>
    </defaultDocument>
</system.webServer>
 <connectionStrings>
   <add name="myConnectionString" 
    connectionString="Server=Server;Database=Backend_UM;User 
   ID=sa;Password=Password;Trusted_Connection=False;" 
  providerName="System.Data.SqlClient" />
 </connectionStrings>
</configuration>

ASPCode: ASPCode:

     string x = Environment.UserName;
        string y = Page.User.Identity.Name;
        string strName = HttpContext.Current.User.Identity.Name.ToString();

        WindowsIdentity currentIdentity = WindowsIdentity.GetCurrent();
        string NTlogin = currentIdentity.Name.ToString();



        string[] login_name = NTlogin.Split('\\');
        login = loginid.Text = login_name[1];

Authentications: 认证:

Windows Authentication: Enabled Windows身份验证:已启用

ASP.net impersonation : Enabled ASP.net模拟:已启用

Forum Authentication: Disabled 论坛身份验证:已禁用

Anonymous Authentication : Disabled 匿名身份验证:已禁用

Identity: ApplicationPoolIdentity 身份:ApplicationPoolIdentity

The Login Variable in the Asp code is suppose to be the NT login Username of the Person trying to Access it, but whoever tries to Access the Website the Login Variable is the Username of the Server On which the portal is deployed. Asp代码中的登录变量假定是尝试访问它的人员的NT登录用户名,但是无论谁尝试访问网站,登录变量都是部署门户网站的服务器的用户名。

The Issue was resolved. 问题已解决。 While deploying the website i needed to check the windows authentication check box. 在部署网站时,我需要选中Windows身份验证复选框。 Since i was not doing that before the website would only take the user name of the server on which it was deployed. 由于我没有这样做,因此网站只会采用部署它的服务器的用户名。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM