真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.netmsdn的簡單介紹

VB.NET HttpWebRequest根據(jù)MSDN寫法獲取不到COOKIE,有的可以但不完整

嘿嘿,試試下面這個(gè)api

創(chuàng)新互聯(lián)主要從事網(wǎng)站建設(shè)、成都網(wǎng)站制作、網(wǎng)頁設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)安仁,10年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來電咨詢建站服務(wù):18980820575

Private?Const?INTERNET_COOKIE_HTTPONLY?As?Integer?=?H2000

SuppressUnmanagedCodeSecurity,?SecurityCritical,?DllImport("wininet.dll",?EntryPoint:="InternetGetCookieExW",?SetLastError:=True,?ExactSpelling:=True)

Friend?Function?InternetGetCookieEx([In]?Url?As?String,?[In]?cookieName?As?String,?Out?cookieData?As?StringBuilder,?[In],?Out?ByRef?pchCookieData?As?UInteger,?flags?As?UInteger,?reserved?As?IntPtr)?As?Boolean

End?Function

'''?summary

'''?獲取webbrowser登錄成功后的cookie,需要帶上登錄成功后的URL

'''?/summary

'''?param?name="url"/param

'''?returns/returns

SecurityCritical()

Public?Function?GetCookie(url?As?String)?As?String

Dim?size?As?UInteger?=?0

Dim?sb?As?New?StringBuilder

If?InternetGetCookieEx(url,?vbNullString,?Nothing,?size,?INTERNET_COOKIE_HTTPONLY,?IntPtr.Zero)?Then?'--?this?always?returns?false

If?size?=?0?Then

Return?Nothing

End?If

sb?=?New?StringBuilder(Convert.ToInt32(size)?+?1)

If?Not?InternetGetCookieEx(url,?vbNullString,?sb,?size,?INTERNET_COOKIE_HTTPONLY,?IntPtr.Zero)?Then

Return?Nothing

End?If

End?If

Dim?lastErrorCode?=?Marshal.GetLastWin32Error?'--?259

Return?sb.ToString()

End?Function

另外,再給你一個(gè)函數(shù)

'''?summary

'''?字符串型的cookie轉(zhuǎn)換成cookie型的cookiecollection

'''?/summary

'''?param?name="cookieStr"/param

'''?param?name="cookie"/param

'''?param?name="domain"/param

Public?Sub?StringToCookie(ByVal?cookieStr?As?String,?ByRef?cookie?As?CookieContainer,?ByVal?domain?As?String)

cookie?=?New?CookieContainer()

Debug.Print($"過程:{New?StackTrace().GetFrame(0).GetMethod.Name}?轉(zhuǎn)換cookie開始")

Try

Dim?cookstr?As?String()?=?cookieStr.Split(";"c)

Dim?cookieName?As?String?=?""

Dim?cookieValue?As?String?=?""

For?Each?str?As?String?In?cookstr

cookieName?=?str.Substring(0,?InStr(str,?"=")?-?1).Trim()

cookieValue?=?str.Substring(InStr(str,?"="),?str.Length?-?InStr(str,?"=")).Trim()

Dim?ck?As?New?Cookie(cookieName,?cookieValue)

'Debug.Print($"{cookieName}?=?{cookieValue}")

ck.Domain?=?domain

cookie.Add(ck)

Next

Debug.Print($"過程:{New?StackTrace().GetFrame(0).GetMethod.Name}?轉(zhuǎn)換cookie成功")

Catch?ex?As?Exception

Debug.Print($"過程:{New?StackTrace().GetFrame(0).GetMethod.Name}?{ex.StackTrace.ToString()}")

Finally

Debug.Print($"過程:{New?StackTrace().GetFrame(0).GetMethod.Name}?轉(zhuǎn)換cookie結(jié)束")

End?Try

End?Sub

vb.net msdn 哪有下載

vb.net的MSDN都在微軟的網(wǎng)站上,因?yàn)槲④浢刻於荚诟翸SDN的內(nèi)容,當(dāng)然也有離線版,不過容量太大(10多G),不建議安裝,如果要裝的話,請參考:

vb.net的VS2010不知道有沒msdn幫助文檔。

msdn文檔在網(wǎng)頁上有,瀏覽器打開就可以看到了。如果想看某個(gè)類庫的介紹的話,直接在網(wǎng)址后面加上完整命名空間,比如就行了


網(wǎng)站名稱:vb.netmsdn的簡單介紹
分享網(wǎng)址:http://weahome.cn/article/dojjsig.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部