2011-08-19 2 views
0

WinCE에서 RFID 핸드 헬드를 실행하고 있습니다. 공급 업체는 스캔 한 RFID 태그에서 RFID 코드를 읽고 응용 프로그램 자체 (Windows Form)에 표시하는 간단한 응용 프로그램의 소스 코드를 제공했습니다. 어떻게 든이 값을 내 웹 응용 프로그램에 도달하지 마세요 물마루 POST, GET 메서드 또는 새 IE 창을 여는. 조언 해 주셔서 감사합니다.WinCE C# App에서 WebApp로 텍스트 값 전달

답변

0

당신은 WebRequest 클래스의 객체를 생성하고 약간 문제가있는 웹 페이지에 게시 할 수 있습니다

http://msdn.microsoft.com/en-us/library/debx8sh9.aspx

// Create a request using a URL that can receive a post. 
WebRequest request = WebRequest.Create ("http://www.contoso.com/PostAccepter.aspx "); 
// Set the Method property of the request to POST. 
request.Method = "POST"; 
// Create POST data and convert it to a byte array. 
string postData = "This is a test that posts this string to a Web server."; 
byte[] byteArray = Encoding.UTF8.GetBytes (postData); 
// Set the ContentType property of the WebRequest. 
request.ContentType = "application/x-www-form-urlencoded"; 
// Set the ContentLength property of the WebRequest. 
request.ContentLength = byteArray.Length; 
// Get the request stream. 
Stream dataStream = request.GetRequestStream(); 
// Write the data to the request stream. 
dataStream.Write (byteArray, 0, byteArray.Length); 
// Close the Stream object. 
dataStream.Close(); 
// Get the response. 
WebResponse response = request.GetResponse(); 
// Display the status. 
Console.WriteLine (((HttpWebResponse)response).StatusDescription); 
// Get the stream containing content returned by the server. 
dataStream = response.GetResponseStream(); 
// Open the stream using a StreamReader for easy access. 
StreamReader reader = new StreamReader (dataStream); 
// Read the content. 
string responseFromServer = reader.ReadToEnd(); 
// Display the content. 
Console.WriteLine (responseFromServer); 
// Clean up the streams. 
reader.Close(); 
dataStream.Close(); 
response.Close();