ApprenticeCoder
ApprenticeCoder

Reputation: 61

Asking windows credentials in my C# program?

I'm building a software application and it was requested that a user/pass system be implemented with it for security reasons. I'm implementing it in Visual Studio and was curious to if it was possible that I prompt the windows login/pass be used instead of having to build my own structure? Thanks in advance

Upvotes: 5

Views: 3029

Answers (1)

Ani
Ani

Reputation: 10896

What you're looking for is the Windows API CredUIPromptForCredentials. Here is how you use it from C# - PInvoke

However, note that this returns the plaintext username and password to your application. This might be a security issue depending on if your user trusts your app or not.

I don't know any way to invalidate the current credentials so Windows forces a prompt for internal NTLM/Kerberos auth.

Upvotes: 6

Related Questions