![](/img/trans.png)
[英]how to can get Network Credential username and password on webservice request .net core?
[英]How to Get and Change Windows Credential Username and Password
我想使用WMI在C#中編寫一個應用程序,它可以獲取和更改存儲在Windows憑據管理器中的Windows憑據,如下圖所示:
Ookii.Dialogs包含一個憑證對話框,可以根據需要調用CredUIPromptForCredentials或CredUIPromptForWindowsCredentials 。
編輯:Credentials API詳見http://msdn.microsoft.com/en-us/library/aa374731%28v=VS.85%29.aspx#credentials_management_ui_functions - 但從托管代碼實現可能很棘手。 在CredUIPromptForWindowsCredentials之后,您將調用CredWrite來保存憑據。
[void] Windows.Security.Credentials.PasswordVault,Windows.Security.Credentials,ContentType = WindowsRuntime](new-object Windows.Security.Credentials.PasswordVault).RetrieveAll()| %{$ .RetrievePassword(); $ }
沒有Windows API來獲取用戶的密碼。 密碼不存儲在Windows中。 相反,Windows存儲單向散列版本。
您可以使用WindowsIdentity.GetCurrent()獲取用戶名。 或者,您可以通過Environment.UserName屬性獲取登錄的用戶名。
雖然改變憑據.....祝你好運:)這就是我最好的答案。 我不認為微軟會給我們這樣做的能力。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.