How to access the stored credentials (PasswordVault?) on Win7 and Win8?

后端 未结 3 1988
[愿得一人]
[愿得一人] 2020-12-01 19:20

I just discovered that Win8 has a section on the Control Panel called User Accounts and Family Safely with Credential Manager. I\'d like to access the cred

相关标签:
3条回答
  • 2020-12-01 19:30

    How to: Add or Remove References By Using the Reference Manager says:

    In the desktop projects the Core tab doesn’t appear by default. You can add the Windows Runtime by opening the shortcut menu for the project node, choosing Unload Project, adding the following snippet, and re-opening the project (on the project node choose Reload Project). When you invoke the Reference Manager dialog box, the Core tab appears.

    <PropertyGroup>
        <TargetPlatformVersion>8.0</TargetPlatformVersion>
    </PropertyGroup>
    

    Make sure to check the Windows box on this tab. You should then be able to use WinRT elements.

    0 讨论(0)
  • 2020-12-01 19:34

    You can use wrapped Credential Management package. It's an open-source project. I checked it in Windows 7 and it works right.

    In order to save your data use following code:

        Credential saved = new Credential("username", "password", "MyApp", CredentialType.Generic);
        saved.PersistanceType = PersistanceType.LocalComputer;
        saved.Save();
    

    And to load your data use:

        Credential credential = new Credential { Target = "MyApp", Type = CredentialType.Generic };
        credential.Load();
    
    0 讨论(0)
  • 2020-12-01 19:38

    I came across the same issue and found out that there is no simple answer anywhere.

    This is what I found:

    1. You need to unload the project and add the TargetPlatformVersion as mentioned above.
    2. Add the reference: C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral\Annotated\Windows.winmd
    3. Also add the reference: C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETCore\v4.5\System.Runtime.WindowsRuntime.dll
    0 讨论(0)
提交回复
热议问题