Constructor

Namespace: Sfs2X.Requests
Assembly: SmartFox2 (in SmartFox2.dll) Version: 0.9.14.0

Syntax

C#
public LoginRequest(
	string userName,
	string password,
	string zoneName,
	ISFSObject parameters
)

Parameters

userName
Type: System..::..String
the user name (optional)
password
Type: System..::..String
the password (optional)
zoneName
Type: System..::..String
the name of an existing Zone in the server (case sensitive, 'SimpleChat' != 'simplechat'). If no Zone is specified the SmartFox.Config.Zone parameter will be used.
parameters
Type: Sfs2X.Entities.Data..::..ISFSObject
the custom parameters (optional, if you use an Extension on server side to handle the login)

Examples

CopyC#
smartFox.AddEventListener(SFSEvent.LOGIN, OnLogin);
smartFox.AddEventListener(SFSEvent.LOGIN_ERROR, OnLoginError);

// Login passing only the user name, no password and the zone name is obtained
// from the previously loaded configuration
smartFox.Send(new LoginRequest("FozzieTheBear"));

void OnLogin(BaseEvent evt) {
    Console.WriteLine("Login success!");
}

void OnLoginError(BaseEvent evt) {
    Console.WriteLine("Login failure: " + (string)evt.Params["errorMessage"]);
}

See Also