2010-04-10 1 views

답변

2

WebClient 클래스를 사용할 수 있습니다. Content-Type 헤더를 application/x-www-form-urlencoded으로 설정 한 다음 UploadData 메서드를 사용해야합니다. documentation of that method은 기본적으로 다음과 같이 요약 될 간단한 예를 포함

Dim myWebClient As New WebClient() 
myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded") 

Dim responseArray = myWebClient.UploadData("http://...", "POST", Encoding.ASCII.GetBytes(postData)) 
Dim response = Encoding.ASCII.GetString(responseArray) 

Wikipedia page of HTTP POST는 POST 데이터를 부호화해야하는 정보를 포함

각 키 - 값 쌍에가함으로써 분리된다 ' & '문자가 있으며 각 키는'= '문자로 값과 구분됩니다. 키와 값 모두 공백을 '+'문자로 바꾸고 다른 모든 문자에 URL 인코딩을 사용하여 이스케이프 처리됩니다.

그래서, 당신의 postData 변수는 다음과 같이 작성 될 수있다 (당신이 게시 할 필드가 호출된다고 가정 사용자 이름 및 암호) :

Dim postData = String.Format("Username={0}&Password={1}", _ 
    HttpUtility.UrlEncode(username), _ 
    HttpUtility.UrlEncode(password)) 
관련 문제