SmartFoxServer Silverlight API
Login Method (zone, name, pass)
Namespaces ► SmartFoxClientAPI ► SmartFoxClient ► Login(String, String, String)
Perform the default login procedure.
The standard SmartFoxServer login procedure accepts guest users. If a user logs in with an empty username, the server automatically creates a name for the client using the format guest_n, where n is a progressive number.
Also, the provided username and password are checked against the moderators list (see the SmartFoxServer server-side configuration) and if a user matches it, he is set as a Moderator.
Declaration Syntax

C# | Visual Basic | Visual C++

    public void Login(
    	string zone,
    	string name,
    	string pass
    )

    Public Sub Login ( _
    	zone As String, _
    	name As String, _
    	pass As String _
    )

    public:
    void Login(
    	String^ zone,
    	String^ name,
    	String^ pass
    )

Parameters

zone (String)
  the name of the zone to log into.

name (String)
  the user name.

pass (String)
  the user password.

Remarks

NOTE 1:
duplicate names in the same zone are not allowed.

NOTE 2:
for SmartFoxServer Basic, where a server-side custom login procedure can't be implemented due to the lack of extensions support, a custom client-side procedure can be used, for example to check usernames against a database using a php/asp page.
In this case, this should be done BEFORE calling the login method. This way, once the client is validated, the stadard login procedure can be used.

Sends:
SFSEvent..::.OnLoginDelegate

Version:
SmartFoxServer Basic / Pro

Examples
The following example shows how to login into a zone.
CopyC#

    SFSEvent.onLogin += OnLogin;

    smartFox.Login("simpleChat", "jack");

    public void OnLogin(bool success, string name, string error)
    {
        if (success)
            Debug.WriteLine("Successfully logged in as " + name);
        else
            Debug.WriteLine("Zone login error; the following error occurred: " + error);
    }

See Also
Logout()()()
SFSEvent..::.OnLoginDelegate

Assembly: SmartFoxClientAPI_Silverlight (Module: SmartFoxClientAPI_Silverlight) Version: 1.0.0.0 (1.0.0.0)