Windows native password prompt from .NET
What is the best way to prompt a user for username/password using .NET 4? I could build my own promp开发者_JS百科t using the WPF PasswordBox, but it seems like this should be part of the framework.
Ultimately I'd like it to work with Windows XP, Vista and 7, but Windows 7 is enough to get me started.
I have searched the web but the solutions I've found seem dated.
If there is a better way to authenticate users with WCF (using both Windows and UserName authentication) I'd be happy to know about it.
There's some code at How to show authentication dialog in C# .Net 3.5 SP1 which seems to work, although it shows the old school XP dialog:
It's about 100 lines of code - a bit much for such a common task which (IMO) should be part of the framework.
精彩评论