Is there a Win32 function I can call to show a Windows login dialog?
E.g., Internet Explorer and Visual Studio’s Team Explorer both show a credentials dialog when accessing a website – how can I show that dialog?
I have a .NET Windows client application that uses the logged in Windows user identity when communicating to web services. The services use that user ID to determine who is calling the service and to decide what they have permissions to see.
I would like to add a command that allows the current user to do effectively a “run as”, where they can enter the username/password of another user and we have the application act as them.
I could build a custom dialog and use the LoginUser() function, but I would rather use something “official”.
You can use the CredUIPromptForCredentials API function
See also here
I think you’re stuck creating your own dialog. It’s not that hard to make it look official though.