|
其他信息: 对 PInvoke 函数“测试!测试.后台处理::InternetGetCookieEx”的调用导致堆栈不对称。原因可能是托管的 PInvoke 签名与非托管的目标签名不匹配。请检查 PInvoke 签名的调用约定和参数与非托管的目标签名是否匹配。
我的环境是4.5的.报以上错误.因为我主程序是4.5的.而且自己写的控件和函数全部基于4.5的.不知道这个应该怎么处理了
代码如下:获取COOKIE的
'取当前webBrowser登录后的Cookie值
<DllImport("wininet.dll", CharSet:=CharSet.Auto, SetLastError:=True)> _
Private Shared Function InternetGetCookieEx(pchURL As String, pchCookieName As String, pchCookieData As StringBuilder, ByRef pcchCookieData As Integer, dwFlags As Integer, lpReserved As Object) As Boolean
End Function
'取出Cookie,当登录后才能取
Private Shared Function GetCookieString(url As String) As String
' Determine the size of the cookie
Dim datasize As Integer = 256
Dim cookieData As New StringBuilder(datasize)
If Not InternetGetCookieEx(url, Nothing, cookieData, datasize, &H2000, Nothing) Then
If datasize < 0 Then
Return Nothing
End If
' Allocate stringbuilder large enough to hold the cookie
cookieData = New StringBuilder(datasize)
If Not InternetGetCookieEx(url, Nothing, cookieData, datasize, &H2000, Nothing) Then
Return Nothing
End If
End If
Return cookieData.ToString()
End Function
报错部分是加粗的.代码我用的是VB.NET写的.麻烦各位帮忙解决下
|
|