这里暂时没有写到对http数据头的定义
当然头的定义可以这样写
Dim head As WebHeaderCollection
head.Add("name", "value")
send.Headers = head
这里暂时没有写到对http数据头的定义
当然头的定义可以这样写
Dim head As WebHeaderCollection head.Add("name", "value") send.Headers = head
好了,归到正题,下面是类,接收到的是一个stream,这样方便利用哈!
Imports System.Net Imports System.io PublicClass httpClass http PublicFunction httpsend()Function httpsend(ByVal uri AsString, ByVal method AsString, ByVal content AsString) As Stream Dim send As WebRequest = WebRequest.Create(uri) send.Method = method Dim postdata AsByte() postdata = System.Text.Encoding.Default.GetBytes(content) send.ContentLength = postdata.Length Dim postStream As Stream = send.GetRequestStream() postStream.Write(postdata, 0, postdata.Length) postStream.Close() Dim re As WebResponse = send.GetResponse Return re.GetResponseStream End Function End Class
对应的接收页面可以在LOAD事件里这样写
IfNotIsDBNull(Request) Then Dim a As Stream = Request.InputStream endif