Last post Jan 29, 2019 07:17 AM by Nan Yu
Jan 24, 2019 06:41 AM|pathipati|LINK
I am using below code to reset windows password. but it is throwing below error.
A specified logon session does not exist. It may already have been terminated.
using (var context = new PrincipalContext(ContextType.Machine, domain, null, ContextOptions.Negotiate, "XXXXX", "YYYYY"))
using (var user = UserPrincipal.FindByIdentity(context, IdentityType.SamAccountName, userName))
Jan 25, 2019 03:41 AM|Nan Yu|LINK
Hi pathipati ,
Could you please explain more about your requirement ? Do you want to change membership/identity user's password or you want to change windows account user's password ?
Jan 25, 2019 03:57 AM|pathipati|LINK
Hi, Nan Yu,
Thanks for your response.
I am looking to Reset Users Windows Password from Administration Level.
Jan 25, 2019 08:54 AM|Nan Yu|LINK
Hi pathipati ,
I haven't met the issue . Where do you put the codes , in global.ascx ? You can also refer to below links for code sample :
Jan 25, 2019 09:55 AM|pathipati|LINK
My above code is working when the AppPool is set to 'LocalSystem' and not 'ApplicationPoolIdentity'. is it harm to set AppPool to LocalSystem
Jan 29, 2019 07:17 AM|Nan Yu|LINK
Local system has the highest privilege and should avoid , so the problem is the service account was not given the permissions to change/reset passwords if you are using service account with appropriate AD permissions.