当前位置:编程学习 > C#/ASP.NET >>

关于网页post的问题 帮忙看看什么地方出了问题!

Dim Post As String = Http.httpPost("http://id.qq.com/cgi-bin/userinfo_mod", _
        "&ln=999999999999999999999999&ldw=3c248bfe87b94801f45bfd3130aff8443447448878f486c6", cookie, _
        cookie, "http://id.qq.com/myself/myself.html?ver=10045&")

 Public Shared Function httpPost(ByVal Url As String, ByVal postdate As String, ByVal submitcookie As String, ByRef returncookie As String, ByVal Referer As String) As String
        Try
            Dim Request As HttpWebRequest = DirectCast(HttpWebRequest.Create(Url), HttpWebRequest)
            Dim cookie As New CookieContainer()
            Dim site As New Uri(Referer)
            Dim Array As String() = Regex.Split(submitcookie, ";")
            For Each Sarray As String In Array
                cookie.SetCookies(site, Sarray.ToString())
            Next
            Request.Proxy = Nothing
            Request.Timeout = 50000
            Request.AllowAutoRedirect = True
            Request.MaximumAutomaticRedirections = 5
            '请求的最大数目;
            Request.ContentType = "application/x-www-form-urlencoded"
            Request.UserAgent = "Mozilla/5.0 (SymbianOS/9.1; U; en-us) AppleWebKit/413 (KHTML, like Gecko) Safari/413"
            Request.Referer = Referer
            Request.CookieContainer = cookie
            Request.Accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*"
            Request.Method = "POST"
            Dim [Byte] As Byte() = Encoding.GetEncoding("UTF-8").GetBytes(postdate)
            Request.ContentLength = [Byte].Length
            Dim Poststream As Stream = Request.GetRequestStream()
            Poststream.Write([Byte], 0, [Byte].Length)
            Poststream.Close()
            Dim Response As HttpWebResponse = DirectCast(Request.GetResponse(), HttpWebResponse)
            Request.KeepAlive = True
            Dim content As String = New StreamReader(Response.GetResponseStream(), Encoding.GetEncoding("utf-8")).ReadToEnd()
            Request.Abort()
            Response.Close()
            For Each ck As Cookie In Response.Cookies
                returncookie += ck.Name + "=" + ck.Value & "; "
            Next
            Return content
        Catch e As Exception
            Return e.Message
        End Try
    End Function


post返回信息是  vb post VB.NET
补充:.NET技术 ,  VB.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,