Get Classic ASP variable from posted JSON

后端 未结 8 1972
挽巷
挽巷 2021-02-08 11:01

I\'m trying to post JSON via AJAX to a Classic ASP page, which retrieves the value, checks a database and returns JSON to the original page.

I can post JSON via AJAX. I

8条回答
  •  野性不改
    2021-02-08 11:20

    Here is the solution that i used in ASP Vbscript with Radium's code and some corrections:

    bytecount = Request.TotalBytes
    bytes = Request.BinaryRead(bytecount)
    
    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"                      
            s = stream.ReadText() 'here is your json as a string                
        stream.Close()
    Set stream = nothing
    
    Response.write(s)
    

提交回复
热议问题