设置/获取Web Cookie [英] Set/Get Web Cookies

查看:359
本文介绍了设置/获取Web Cookie的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我没有运行任何类型的服务器端脚本,我如何设置 get 在VBA代码中?

Assuming I am not running server side scripting of any kind, how can I set and get a cookie from within VBA code?

推荐答案

我看到有关此事的发布可能有助于设置Cookie:

I saw a posting about this that might help for setting the cookie:

链接文字

这是他的代码片段:

Sub test()
Dim w As New WinHttp.WinHttpRequest
Dim t As String, qs As String
qs = "this=that&more=less"
w.Open "POST", "http://www.comparity.net/perl/form.pl?a=b", False
w.setRequestHeader "Cookie", "one=foo"
w.setRequestHeader "Cookie", "two=bar"
w.send qs
t = w.responseText
WriteTextFile "c:\test.html", t
Debug.Print w.Status
Debug.Print t
End Sub

不知道如何获取cookie - 其中一个主要海报提到XmlHttp删除Cookie出于安全原因。

Not sure about getting the cookie - one of the main posters mentions that XmlHttp strips out cookies for security reasons.

希望这可能会让你开始!

Hope that might get you started!

这篇关于设置/获取Web Cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆