gpt4 book ai didi

asp.net - 更改用户登录名后认证错误

转载 作者:行者123 更新时间:2023-12-02 08:06:14 25 4
gpt4 key购买 nike

我们有一位用户最近更改了姓名。

假设旧用户名是 old.name,新用户名是 new.name。

编辑 AD 中的详细信息并使用新用户名注销/登录后,我们的 ASP.NET 应用程序显示旧名称。

纯 ASP.NET,无 MVC,使用 Windows 身份验证。

获取用户名的代码为:

WindowsPrincipal wp = (WindowsPrincipal)HttpContext.Current.User;
String userName = wp.Identity.Name.Substring(wp.Identity.Name.IndexOf("\\") + 1);

这将返回旧名称,而不是新名称。

我检查了 IIS 日志文件,这些文件显示了新名称:

2011-04-05 11:41:44 W3SVC1 MARS 10.57.1.64 GET /eft/Default.aspx - 80 - 10.57.0.161 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.2;+Trident/4.0;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729;+.NET4.0C;+.NET4.0E) 401 2 2148074254

2011-04-05 11:41:44 W3SVC1 MARS 10.57.1.64 GET /eft/Default.aspx - 80 SANOMABP\new.name 10.57.0.161 Mozilla/4.0+(compatible;+MSIE+7.0;+Windows+NT+5.2;+Trident/4.0;+.NET+CLR+1.1.4322;+.NET+CLR+2.0.50727;+.NET+CLR+3.0.4506.2152;+.NET+CLR+3.5.30729;+.NET4.0C;+.NET4.0E) 200 0 0

我们已经重新启动了应用程序池,我们已经检查了 AD 数据,并且我们不知道可能出现什么问题。

最佳答案

为了清晰起见,从评论中移出正确答案:

@paolo: you may try looking at support.microsoft.com/kb/946358

Workaround


To work around this issue, disable the local SID cache on the domain member computer. To do this, follow these steps:

  1. Open Registry Editor.

    To do this in Windows XP or in Windows Server 2003, click Start, click Run, type regedit, and then click OK.

    To do this in Windows Vista and newer, Click Start, type regedit in the Start Search box, and then press ENTER.

  2. Locate and then right-click the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Lsa

  3. Point to New, and then click DWORD Value.

  4. Type LsaLookupCacheMaxSize, and then press ENTER.

  5. Right-click LsaLookupCacheMaxSize, and then click Modify.

  6. In the Value data box, type 0, and then click OK.

  7. Exit Registry Editor.

关于asp.net - 更改用户登录名后认证错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5551489/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com