C#: Ask User for a Password which is then stored in a SecureString

In the small application that I'm currently developing for a customer I need to ask the user for his windows login username, password and domain and then use those with System.Diagnostics.Process.Start to start an application.

I have a textbox with UseSystemPasswordChar to mask the entered password.

I need a System.Security.SecureString to feed the password to System.Diagnostics.Process.Start.

How do I convert the entered text to secure string while not doing it one character after another? Alternatively: Is there a better window control to ask the user for a password that returns the entered text as SecureString?

Answers


Try looking at the SecurePasswordTextBox custom control. Are you trying to do something similar to a "Run As" type command where you are trying to run the process as a different user than the one currently logged on? If not, you should be able to just call Process.Start and let it pick up the current users credentials.

Also, take a look at the following resources as well:

The best option would probably be to use some interop p/inovke code to call CredUIPromptForCredentials to display the standard Windows dialog box and then use that information to either call Process.Start, or, more likely, call the CreateProcessAsUser function.


Need Your Help

Problem with Sharepoint speed using sharepoint Object Model: get user's group from userID

sharepoint sharepoint-2007

I am quite stumped with this. In enhancing an existing feature to a SharePoint solution, I found that they were querying the Wss_Content directly. Knowing I should not be using that stored proced...

Non-Intersect Range VBA

excel-vba

In the below code rngIntersect.Address returns A10. Is there way where in i can get all ranges excluding intersection without looping?

using onmouseover to change text hyperlink into an image hyperlink?

javascript html

Please bear with me I am brand new to learning javascript (self taught)! I am usually one to find answers on my own from just web browsing but so far I haven't found any resources explaining how to

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.