简体   繁体   English

AD身份验证未知的用户名或密码错误

[英]AD Authentication Unknown username or bad password

I am using VS2005 C#. 我正在使用VS2005 C#。

I am trying to switch my login authentication from the ASP.NET Web Site Administration Tool from using Internet to Local Network , which is the Windows authentication. 我试图将登录身份验证从ASP.NET网站管理工具从使用Internet切换到Windows 网络身份验证,即本地网络

I have set the MembershipProvider of my Login tool in my web form to my MP name, MyADMembershipProvider . 我已经在我的Web表单中将“登录”工具的MembershipProvider设置为我的MP名称MyADMembershipProvider

Below is my current web.config file after making some changes: 进行一些更改后,下面是我当前的web.config文件:

<configuration>
    <appSettings/>
    <connectionStrings>
        <add name="SODConnectionString" connectionString="CONNECTIONSTRING" providerName="System.Data.SqlClient"/>

        <add name="ADConnectionString" connectionString="LDAP://URL"/>
    </connectionStrings>
    <system.web>
        <authentication mode="Windows" />
    <roleManager enabled="true" />
    <pages styleSheetTheme="DataWebControls"/>
        <membership defaultProvider="MyADMembershipProvider">
            <providers>
                <clear/>
                <add name="MyADMembershipProvider" type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=PUBTOKEN" applicationName="SOD" connectionStringName="ADConnectionString" connectionUsername="domain\Username" connectionPassword="Password" attributeMapUsername="sAMAccountName" enableSearchMethods="true" />
            </providers>

        </membership>
        <siteMap defaultProvider="XmlSiteMapProvider" enabled="true">
            <providers>
                <add name="XmlSiteMapProvider"
      description="Default SiteMap provider."
      type="System.Web.XmlSiteMapProvider"
      siteMapFile="Web.sitemap"
      securityTrimmingEnabled="true" />
            </providers>
        </siteMap>
            <compilation debug="true"/>
            <!-- Turn on Custom Errors -->
        <customErrors defaultRedirect="~/Error/NetworkError.aspx" mode="On">
   <error statusCode="404" redirect="~/Error/PageNotFound.aspx" />
  </customErrors>
    </system.web>
</configuration>`

I am currently receiving a configuration parse error message: Logon failure: unknown user name or bad password when I tried to log on with my Windows credentials of my machine within the intranet. 我当前收到配置解析错误消息: 登录失败:尝试使用Intranet中计算机的Windows凭据登录时, 未知的用户名或错误的密码

The error pointed out line 错误指出线

<add name="MyADMembershipProvider" 
     type="System.Web.Security.ActiveDirectoryMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" 
     applicationName="SOD" 
     connectionStringName="ADConnectionString" 
     connectionUsername="domain\Username" 
     connectionPassword="Password" 
     attributeMapUsername="sAMAccountName" 
     enableSearchMethods="true" />

has an error. 有错误。

May I know which part of my code went wrong? 我可以知道代码的哪一部分出错了吗?


EDIT: 编辑:

I have filled in the actual credentials for the code 我已经填写了代码的实际凭证

connectionUsername="domain\Username" connectionPassword="Password"

I am now able to login with the correct credentials, and I am also prompted wrong credential for incorrect log in attempts. 现在,我可以使用正确的凭据登录,并且还会提示我凭据错误,表示登录尝试不正确。

When another user of different credential from the one I 'hardcoded' in the connectionUsername and connectionPassword , the user is still able to log on. 当另一个用户的凭据与我在connectionUsernameconnectionPassword “硬编码”的凭据不同时,该用户仍可以登录。

However, my LoginName tool from the toolbox still shows the username of the 'hardcoded' credentials in the connectionUsername instead of the username of the logged in user. 但是,我在工具箱中的LoginName工具仍然在connectionUsername显示“硬编码”凭据的用户名,而不是已登录用户的用户名。

May I know why is it so? 我可以知道为什么会这样吗?

I believe the error is with the membership provider and not specifically with the logon. 我相信该错误是由成员资格提供者而不是登录引起的。

It looks to me that the connectionUsername and connectionPassword properties in the membership provider are not specifying a valid AD account. 在我看来,成员资格提供程序中的connectionUsername和connectionPassword属性未指定有效的AD帐户。 I believe this account is used to verify the credentials during the logon process and to retrieve information about the account once it is logged on. 我相信此帐户用于在登录过程中验证凭据,并在登录后检索有关该帐户的信息。

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

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