WindowsIdentity.Impersonate does not work on Windows 11

Kumar, Chandan 0 Reputation points
2024-06-24T18:00:32.3266667+00:00

WindowsIdentity.Impersonate does not work on Windows 11.

The code example given at below link works well on Windows 10, but throw error that username and password is incorrect on Windows 11.

WindowsIdentity.Impersonate Method

Windows 10 Build version - Version 10.0.19044 Build 19044 --> On this it is working

Windows 11 Build version - Version 10.0.22621 Build 22621 --> On this it is not working

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,113 questions
Windows 11
Windows 11
A Microsoft operating system designed for productivity, creativity, and ease of use.
8,857 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Neuvi Jiang 685 Reputation points Microsoft Vendor
    2024-06-27T05:24:50.1366667+00:00

    Hi Kumar, Chandan,

    Thank you for posting in the Q&A Forums.

    Windows 11 may introduce new security policies or default permission settings that may prevent your application from accessing tokens in the same way. Ensure that your application has sufficient permissions to perform the required actions. Windows 11 may have stricter UAC settings. Ensure that your application correctly handles UAC prompts when requesting elevated privileges. Check the Group Policy and security settings for Windows 11 for any changes related to authentication or token access. Enable detailed logging on Windows 11 and carefully analyze error messages and log entries to get more information about the cause of the failure. Use debugging tools such as WinDbg to trace and debug your application, and see how it behaves when calling Win32 functions. Make sure your app and all dependencies are updated to versions compatible with Windows 11. Check for any known compatibility issues or fixes that may affect the behavior of your application on Windows 11

    Best regards

    NeuviJ

    ============================================

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    0 comments No comments