VB.net 2010 视频教程 VB.net 2010 视频教程 python基础视频教程
SQL Server 2008 视频教程 c#入门经典教程 Visual Basic从门到精通视频教程
当前位置:
首页 > VB.net教程 >
  • vb.net WebAPI传输

        Dim encoding As New UTF8Encoding()
        Dim request As HttpWebRequest = WebRequest.Create(“你的地址”)

        request.Method = "POST"
        request.Accept = "text/html, application/xhtml+xml, */*"
        request.ContentType = "application/json"

        Dim buffer As Byte() = encoding.GetBytes(body)
        request.ContentLength = buffer.Length
        request.GetRequestStream().Write(buffer, 0, buffer.Length)
        Dim response As HttpWebResponse = request.GetResponse()

        Using sr As New StreamReader(response.GetResponseStream(), encoding.UTF8)
            Return sr.ReadToEnd()
        End Using
 
 

相关教程