WebClientProtocol.RequestEncoding 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
Encoding XML 웹 서비스에 대한 클라이언트 요청을 만드는 데 사용됩니다.
public:
property System::Text::Encoding ^ RequestEncoding { System::Text::Encoding ^ get(); void set(System::Text::Encoding ^ value); };
public System.Text.Encoding RequestEncoding { get; set; }
[System.ComponentModel.SettingsBindable(true)]
public System.Text.Encoding RequestEncoding { get; set; }
member this.RequestEncoding : System.Text.Encoding with get, set
[<System.ComponentModel.SettingsBindable(true)>]
member this.RequestEncoding : System.Text.Encoding with get, set
Public Property RequestEncoding As Encoding
속성 값
클라이언트 요청에 대한 문자 인코딩입니다. 기본값은 null기본 전송 및 프로토콜에 대한 기본 인코딩을 사용하는 것입니다.
- 특성
예제
다음 예제는 명명 Math된 XML 웹 서비스를 호출하는 ASP.NET Web Form입니다. 함수 내에서 EnterBtn_Click 웹 양식은 RequestEncoding을 UTF-8로 명시적으로 설정합니다.
Important
이 예제에는 잠재적인 보안 위협인 사용자 입력을 허용하는 텍스트 상자가 있습니다. 기본적으로 ASP.NET 웹 페이지는 사용자 입력에 스크립트 또는 HTML 요소가 포함되지 않는지 확인합니다. 자세한 내용은 스크립트 악용 개요를 참조하세요.
<html>
<script language="C#" runat="server">
void EnterBtn_Click(Object Src, EventArgs E)
{
MyMath.Math math = new MyMath.Math();
// Set the Content Type to UTF-8.
math.RequestEncoding = System.Text.Encoding.UTF8;
int total = math.Add(Convert.ToInt32(Num1.Text), Convert.ToInt32(Num2.Text));
Total.Text = "Total: " + total.ToString();
}
</script>
<body>
<form action="MathClient.aspx" runat=server>
Enter the two numbers you want to add and then press the Total button.
<p>
Number 1: <asp:textbox id="Num1" runat=server/> +
Number 2: <asp:textbox id="Num2" runat=server/> =
<asp:button text="Total" Onclick="EnterBtn_Click" runat=server/>
<p>
<asp:label id="Total" runat=server/>
</form>
</body>
</html>
<html>
<script language="VB" runat="server">
Sub EnterBtn_Click(Src As Object, E As EventArgs)
Dim math As New MyMath.Math()
' Set the Content Type to UTF-8.
math.RequestEncoding = System.Text.Encoding.UTF8
Dim iTotal As Integer = math.Add(Convert.ToInt32(Num1.Text), Convert.ToInt32(Num2.Text))
Total.Text = "Total: " & iTotal.ToString()
End Sub
</script>
<body>
<form action="MathClient.aspx" runat=server>
Enter the two numbers you want to add and then press the Total button.
<p>
Number 1: <asp:textbox id="Num1" runat=server/> +
Number 2: <asp:textbox id="Num2" runat=server/> =
<asp:button text="Total" Onclick="EnterBtn_Click" runat=server/>
<p>
<asp:label id="Total" runat=server/>
</form>
</body>
</html>
설명
요청 RequestEncoding 메시지의 인코딩을 결정합니다. ContentType 요청은 인코딩 값으로 주석이 추가됩니다.
SOAP와 같은 WebClientProtocol 특정 프로토콜을 지원에서 SoapHttpClientProtocol 파생되는 클래스는 특정 프로토콜에 대한 인코딩 요구 사항을 준수하도록 이 속성을 설정합니다. 예를 들어 SoapHttpClientProtocol 기본 인코딩을 UTF-8로 설정합니다.