IdnMapping.UseStd3AsciiRules 속성

정의

현재 IdnMapping 개체의 멤버에서 수행한 작업에 표준 명명 규칙이 사용되었는지 또는 비표준 명명 규칙이 사용되었는지를 나타내는 값을 가져오거나 설정합니다.

public:
 property bool UseStd3AsciiRules { bool get(); void set(bool value); };
public bool UseStd3AsciiRules { get; set; }
member this.UseStd3AsciiRules : bool with get, set
Public Property UseStd3AsciiRules As Boolean

속성 값

표준 명명 규칙이 작업에 사용되었으면 true이고, 그렇지 않으면 false입니다.

예제

다음 예제에서는 ASCII 범위의 문자가 U+0000에서 U+007F까지 포함된 URL을 생성하여 두 IdnMapping 개체의 메서드에 GetAscii(String) 전달합니다. 한 개체의 속성은 UseStd3AsciiRulestrue설정되고 다른 개체는 로 설정됩니다 false. 출력은 속성 true 이 인 경우 UseStd3AsciiRules 유효하지 않지만 인 경우 false유효하지 않은 문자를 표시합니다.

using System;
using System.Globalization;

public class Example
{
   public static void Main()
   {
      int nFailed = 0;
      IdnMapping idnStd = new IdnMapping();
      idnStd.UseStd3AsciiRules = true;

      IdnMapping idnRelaxed = new IdnMapping();
      idnRelaxed.UseStd3AsciiRules = false;  // The default, but make it explicit.

      for (int ctr = 0; ctr <= 0x7F; ctr++) {
         string name = $"Prose{ctr}ware.com";

         bool stdFailed = false;
         bool relaxedFailed = false;
         string punyCode = "";
         try {
            punyCode = idnStd.GetAscii(name);
         }
         catch (ArgumentException) {
            stdFailed = true;
         }

         try {
            punyCode = idnRelaxed.GetAscii(name);
         }
         catch (ArgumentException) {
            relaxedFailed = true;
         }

         if (relaxedFailed != stdFailed) {
            Console.Write("U+{0:X4}     ", ctr);
            nFailed++;
            if (nFailed % 5 == 0)
               Console.WriteLine();
         }
      }
   }
}
// The example displays the following output:
//       U+0020     U+0021     U+0022     U+0023     U+0024
//       U+0025     U+0026     U+0027     U+0028     U+0029
//       U+002A     U+002B     U+002C     U+002F     U+003A
//       U+003B     U+003C     U+003D     U+003E     U+003F
//       U+0040     U+005B     U+005C     U+005D     U+005E
//       U+005F     U+0060     U+007B     U+007C     U+007D
//       U+007E
Imports System.Globalization

Module Example
   Public Sub Main()
      Dim nFailed As Integer = 0
      Dim idnStd As New IdnMapping()
      idnStd.UseStd3AsciiRules = True
      
      Dim idnRelaxed As New IdnMapping
      idnRelaxed.UseStd3AsciiRules = False     ' The default, but make it explicit.
      
      For ctr As Integer = 0 To &h7F 
         Dim name As String = "Prose" + ChrW(ctr) + "ware.com"
         
         Dim stdFailed As Boolean = False
         Dim relaxedFailed As Boolean = False
         Dim punyCode As String
         Try
            punyCode = idnStd.GetAscii(name)
         Catch e As ArgumentException
            stdFailed = True
         End Try       
         
         Try
            punyCode = idnRelaxed.GetAscii(name)
         Catch e As ArgumentException
            relaxedFailed = True
         End Try       
         
         If relaxedFailed <> stdFailed Then
            Console.Write("U+{0:X4}     ", ctr)
            nFailed += 1
            If nFailed Mod 5 = 0 Then Console.WriteLine()         
         End If 
      Next   
   End Sub
End Module
' The example displays the following output:
'       U+0020     U+0021     U+0022     U+0023     U+0024
'       U+0025     U+0026     U+0027     U+0028     U+0029
'       U+002A     U+002B     U+002C     U+002F     U+003A
'       U+003B     U+003C     U+003D     U+003E     U+003F
'       U+0040     U+005B     U+005C     U+005D     U+005E
'       U+005F     U+0060     U+007B     U+007C     U+007D
'       U+007E

설명

표준 명명 규칙을 따르는 도메인 이름은 US-ASCII 문자 범위의 특정 문자 하위 집합으로 구성됩니다. 문자는 문자 A~Z, 숫자 0~9, 하이픈(-) 문자(U+002D) 및 마침표(.) 문자입니다. 문자의 경우는 중요하지 않습니다. 완화된 명명 규칙을 사용하면 공백 문자(U+0020), 느낌표 문자(U+0021) 및 언더바 문자(U+005F)를 포함하여 더 광범위한 ASCII 문자를 사용할 수 있습니다. 이 이trueUseStd3AsciiRules 표준 문자만 메서드에서 반환된 레이블에 표시할 GetAscii 수 있습니다.

기본적으로 속성 값 UseStd3AsciiRules 은 이며 falseASCII 문자의 확장된 하위 집합은 레이블에서 허용됩니다.

참고

클래스는 IdnMapping 속성 설정 UseStd3AsciiRules 에 관계없이 도메인 이름 레이블에서 U+0000~ U+001F 및 U+007F를 사용할 수 없습니다. 이 금지는 이름 스푸핑과 같은 보안 공격의 위험을 줄입니다.

적용 대상