SkmXmlApi

Classes | Public Member Functions | Static Public Member Functions | Properties | List of all members
SkmXmlApi.SkmSession Class Reference

The SkmSession provides authentication keeps reference to the session on the Skm server. More...

## Public Member Functions
void | Login (string Username, string Password)
| Logs into the Skm creating a valid session on the Skm server. This method will throw a 'SkmAuthenticationException' exception if the authentication fails or an exception of type 'Exception' for any other error. More...

## Static Public Member Functions
static SkmSession | NewSkmSession (string Address)
| Factory method to create a new SkmSession. This method only initializes and returns a new instance. It does not communicate with the Skm server. More...

## Properties
string | SessionCookie`[get]`
| Session cookie. More...
bool | IsSessionValid`[get]`
| Is true if the session has been logged in and is valid More...
string? | ServerAddress`[get, set]`
| The address of the Skm Server. This can either be an IP address or a resolvable DNS name. More...
SkmUser | User`[get]`
| The user associated to this session More...

## Detailed Description

The SkmSession provides authentication keeps reference to the session on the Skm server.

## Member Function Documentation

## ◆ Login()

void SkmXmlApi.SkmSession.Login | ( | string | Username,
|  | string | Password
| ) |  |

Logs into the Skm creating a valid session on the Skm server. This method will throw a 'SkmAuthenticationException' exception if the authentication fails or an exception of type 'Exception' for any other error.

Parameters

  Username | Username to authenticate
  Password | Password of the user

SkmSession m_session;
/* Create our Skm session object <em>&zwj;/
m_session = SkmSession.NewSkmSession(Server, Port);
try
{
SetStatusInfo("Logging into " + Server);
/</em> Attempt to login <em>&zwj;/
m_session.Login(Username, Password);
}
/</em> Login throws an this exception if there
* was an authentication problem <em>&zwj;/
catch (SkmAuthenticationException ex)
{
MessageBox.Show("Authentication Failed - " + ex.Message,
"Authentication Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
m_session = null;
SetStatusInfo("Authentication failed on " + Server);
return;
}
/</em> Catch all other errors *&zwj;/
catch (Exception ex)
{
MessageBox.Show("Connect Failed - " + ex.Message,
"Connect Error",
MessageBoxButtons.OK,
MessageBoxIcon.Error);
m_session = null;
SetStatusInfo("Connect failed on " + Server);
return;
}

## ◆ NewSkmSession()

static SkmSession SkmXmlApi.SkmSession.NewSkmSession | ( | string | Address | ) |
| static

Factory method to create a new SkmSession. This method only initializes and returns a new instance. It does not communicate with the Skm server.

Parameters

  Address | Skm server address

Returns
  A new instance of the SkmSession

SkmSession m_session;
/* Create our Skm session object *&zwj;/
m_session = SkmSession.NewSkmSession(Server);

## Property Documentation

## ◆ IsSessionValid

bool SkmXmlApi.SkmSession.IsSessionValid
| get

Is true if the session has been logged in and is valid

## ◆ ServerAddress

string? SkmXmlApi.SkmSession.ServerAddress
| get set

The address of the Skm Server. This can either be an IP address or a resolvable DNS name.

## ◆ SessionCookie

string SkmXmlApi.SkmSession.SessionCookie
| get

Session cookie.

## ◆ User

SkmUser SkmXmlApi.SkmSession.User
| get

The user associated to this session

The documentation for this class was generated from the following file:

- src/SkmXmlApi/SkmSession.cs