TamarindoSean
TamarindoSean

Reputation: 91

How to show the user the default windows authentication prompt from a windows form using c#?

I thought this would be a very common practice, but I am having a hard time finding anything on how to show the user a default windows authentication credential prompt in c#?

Users will be using this windows forms app to connect to a web service on a different domain, so I cant just pass in the default credentials. These users will have a separate login to access the web service, and I want them to be prompted by the default Windows prompt, and then I can pass their creds through to the web service.

Thanks!

Upvotes: 4

Views: 2317

Answers (2)

Patrick Pitre
Patrick Pitre

Reputation: 851

This was answered on SO a while back, I believe. You can use the credential management API. Here's a link with a code example that should get you started.

Upvotes: 3

David Heffernan
David Heffernan

Reputation: 613262

You need to P/invoke CredUIPromptForWindowsCredentials on Vista and up, or CredUIPromptForCredentials on XP.

Upvotes: 2

Related Questions