Offers a set of static methods that get or set credentials to or from the credential cache.

Namespace: ININ.IceLib.Connection
Assembly: ININ.IceLib (in ININ.IceLib.dll) Version: 0.0.0.0 (22.3.0.218)

Syntax

C#
public static class CommonCredentials
Visual Basic
Public NotInheritable Class CommonCredentials

Remarks

This allows an application to create a session without prompting for credentials each time by using credentials that were previously saved.

Examples

The following example illustrates one way to store credentials using the CommonCredentials class.

CopyC#
... //Create a session and connect.


     //Connected successfully. Store the credentials so they can be used to login later.
     string applicationName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;

     StoredCredentials credentials = new StoredCredentials(applicationName, _Session, true);
     CommonCredentials.SetCredentials(credentials, true);  //save these credentials and set them as the default set.
...

This example demonstrates how to load the most recently stored credentials between the defaults and those stored for this application.

CopyC#
...
    string applicationName = System.Diagnostics.Process.GetCurrentProcess().ProcessName;

    StoredCredentials credentials = CommonCredentials.GetCredentials(applicationName, 
                                                                     LoadFlags.Default | LoadFlags.Application, 
                                                                     LoadPreference.Newest);

    if ((null != credentials) && credentials.HasPersistedPassword)
    {
        _session.Connect(credentials.SessionSettings,
                     credentials.HostSettings,
                     credentials.AuthSettings,
                     credentials.StationSettings);
    }
    else
    {
        PromptUserForLogin();
    }
...

Examples

The IceLib SDK includes example application references to the CommonCredentials class. Some examples are listed below.
ProjectLocation
TutorialExampleLoginViewModel.cs, line 27, in LoginViewModel.#ctor

Inheritance Hierarchy

System..::..Object
  ININ.IceLib.Connection..::..CommonCredentials

Version Information

Supported for IC Server version 2015 R1 and beyond.
For 4.0, supported for IC Server version 4.0 GA and beyond.
For 3.0, supported for IC Server version 3.0 GA and beyond.

See Also