Tham khảo giá trị của Lanap.BotDetect.CodeTypeEnum

Lanap.BotDetect.CodeTypeEnum là thành viên của BotDetect ASP.NET CAPTCHA bao gồm tất cả các giá trị hợp lệ của kiểu dữ liệu CodeType của Lanap.BotDetect.Captcha. Nó thể hiện các kiểu ký tự được hiển thị trong hình ảnh CAPTCHA và tiếng trong audio CAPTCHA.

Thành viên

[VB.NET]

Public Enum CodeTypeEnum
  Alpha = 0
  Numeric
  AlphaNumeric
End Enum
[C#]

public enum CodeTypeEnum
{
  Alpha = 0,
  Numeric,
  AlphaNumeric
}

Giá trị mặc định

Nếu thuộc tính CodeType không được xác định, CodeTypeEnum.AlphaNumeric được sử dụng như giá trị mặc định.

Cách dùng

[VB.NET]

' Example 1: simple assignment
SampleCaptcha.CodeType = CodeTypeEnum.Alpha

' Example 2: basic randomization
Dim max As Integer = _ 
  System.Enum.GetValues(GetType(CodeTypeEnum)).Length
SampleCaptcha.CodeType = CType(rand.Next(max), CodeTypeEnum)

' the above assumes a global RNG is initialized as follows:  
Public Shared ReadOnly rand As Random = New Random()

' Example 3: basic randomization using RandomizationHelper.vb
SampleCaptcha.CodeType = RandomizationHelper.GetRandomCodeType()

' Example 4: advanced randomization using RandomizationHelper.vb
Dim types As CodeTypeEnum()  = { _
  CodeTypeEnum.Alpha, _
  CodeTypeEnum.Numeric _
}

SampleCaptcha.CodeType = _
  RandomizationHelper.GetRandomCodeType(types)
[C#]

// Example 1: simple assignment
SampleCaptcha.CodeType = CodeTypeEnum.Alpha;

// Example 2: basic randomization
int max = Enum.GetValues(typeof(CodeTypeEnum)).Length;
SampleCaptcha.CodeType = (CodeTypeEnum)(rand.Next(max));

// the above assumes a global RNG is initialized as follows:  
public static readonly Random rand = new Random();

// Example 3: basic randomization using RandomizationHelper.cs
SampleCaptcha.CodeType = RandomizationHelper.GetRandomCodeType();

// Example 4: advanced randomization using RandomizationHelper.cs
CodeTypeEnum[] types = { 
  CodeTypeEnum.Alpha, 
  CodeTypeEnum.Numeric
};

SampleCaptcha.CodeType = 
  RandomizationHelper.GetRandomCodeType(types)

Ghi chú

Để tăng tính thân thiện với người sử dụng, CodeTypeEnum.AlphaNumeric không sử dụng hết các ký tự có sẵn, mà nó loại bỏ một số ký tự để tránh sự nhầm lẫn của người sử dụng như: '1', 'I', '7', 'L', '0', 'O', '5' và 'S'.

Hình ảnh ví dụ

(Sử dụng kiểu "Strippy")

Alpha

Ví dụ về kiểu chữ của BotDetect CAPTCHA Ví dụ về kiểu chữ của BotDetect CAPTCHA

Numeric

Ví dụ về kiểu số của BotDetect CAPTCHA Ví dụ về kiểu số của BotDetect CAPTCHA

AlphaNumeric

Ví dụ về kiểu chữ và số của BotDetect CAPTCHA Ví dụ về kiểu chữ và số của BotDetect CAPTCHA

Phiên bản hiện tại của BotDetect

Xin lưu ý

Trang này là bản dịch tiếng Việt không chính thức của trang gốc tiếng Anh: Lanap.BotDetect.CodeTypeEnum Reference và có thể không chính xác, không đầy đủ hoặc không cập nhật.

Cập nhật ngày 2009-11-30. Áp dụng cho BotDetect ASP.NET CAPTCHA v2.0.15 và BotDetect ASP CAPTCHA v2.0.9.

language: English Español Tiếng Việt