Classic ASP

[ASP] JSON 으로 Request 하기 (Body로 받기)

최고관리자
2020.02.03 14:16 7,658 0

본문

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 = "utf-8"
        BytesToStr = Stream.ReadText
        Stream.Close
    Set Stream = Nothing
End Function


If Request.TotalBytes > 0 Then
    Dim lngBytesCount, jsonText
    lngBytesCount = Request.TotalBytes
    jsonText = BytesToStr(Request.BinaryRead(lngBytesCount))
    Response.ContentType = "text/plain"
    'Response.Write "Your " & Request.ServerVariables("REQUEST_METHOD") & " data was : "
End If


403 에러 시 iis - 응용프로그램 구성 - 매핑 - GET, POST, PUT, DELETE 동사 설정 확인 필요.

댓글목록 0

등록된 댓글이 없습니다.