ASP 방식
Function BytesToStr(bytes)
Dim Stream
Set Stream = Server.CreateObject("Adodb.Stream")
Stream.Type = 1 'adTypeBinary
Stream.Open
Stream.Write bytes
Stream.Position = 0
Stream.Type = 2 'adTypeText
Stream.Charset = "iso-8859-1"
BytesToStr = Stream.ReadText
Stream.Close
Set Stream = Nothing
End Function
If Request.TotalBytes > 0 Then
Dim lngBytesCount
lngBytesCount = Request.TotalBytes
Response.Write BytesToStr(Request.BinaryRead(lngBytesCount))
End If
ASP.NET 방식
string jsonMessage = string.Empty;
System.IO.Stream inputStream = HttpContext.Current.Request.InputStream;
byte[] inputBuffer = new byte[inputStream.Length];
inputStream.Read(inputBuffer, 0, inputBuffer.Length);
try
{
jsonMessage = System.Text.Encoding.UTF8.GetString(inputBuffer);
}
catch (Exception ex)
{
throw ex;
}
return jsonMessage;