Click or drag to resize

BanUserRequest Class

Banishes a user from the server.
Inheritance Hierarchy
SystemObject
  BaseRequest
    Sfs2X.RequestsBanUserRequest

Namespace:  Sfs2X.Requests
Assembly:  SmartFox2X (in SmartFox2X.dll) Version: 1.8.0.0 (1.8.0)
Syntax
C#
public class BanUserRequest : BaseRequest
Constructors
  NameDescription
Public methodBanUserRequest(Int32)
See BanUserRequest(int, string, BanMode, int, int) constructor.
Public methodBanUserRequest(Int32, String)
See BanUserRequest(int, string, BanMode, int, int) constructor.
Public methodBanUserRequest(Int32, String, BanMode)
See BanUserRequest(int, string, BanMode, int, int) constructor.
Public methodBanUserRequest(Int32, String, BanMode, Int32)
See BanUserRequest(int, string, BanMode, int, int) constructor.
Public methodBanUserRequest(Int32, String, BanMode, Int32, Int32)
Creates a new BanUserRequest instance.
Top
Remarks
The current user must have administration or moderation privileges in order to be able to ban another user (see the User.PrivilegeId property). The user can be banned by name or by IP address (see the BanMode class). Also, the request allows sending a message to the banned user (to make clear the reason of the following disconnection) which is delivered by means of the MODERATOR_MESSAGE event.

Differently from the user being kicked (see the KickUserRequest request), a banned user won't be able to connect to the SmartFoxServer instance until the banishment expires (after 24 hours for client-side banning) or an administrator removes his name/IP address from the list of banned users by means of the SmartFoxServer 2X Administration Tool.

Examples
The following example bans the user Jack from the system:
User userToBan = sfs.UserManager.GetUserByName("Jack"); 
sfs.Send( new BanUserRequest(userToBan.Id) );
See Also