cookieContainer应用
PublicSharedFunctionGetCookiesSetByPage(ByVal strUrl AsString,ByVal cookieToProvide AsString)AsIEnumerable(OfString)
Dim req AsSystem.Net.HttpWebRequest
Dim res AsSystem.Net.HttpWebResponse
Dim sr AsSystem.IO.StreamReader
'--notice that the instance is created using webrequest
'--thisis what microsoft recomends
req =System.Net.WebRequest.Create(strUrl)
'set the standard header information
req.Accept="*/*"
req.UserAgent="Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)"
req.ContentType="application/x-www-form-urlencoded"
req.AllowAutoRedirect=False
req.Headers.Add(HttpRequestHeader.Cookie, cookieToProvide)
res = req.GetResponse()
'read in the page
sr =NewSystem.IO.StreamReader(res.GetResponseStream())
Dim strResponse AsString= sr.ReadToEnd
'Get the cooking from teh response
Dim strCookie AsString= res.Headers(System.Net.HttpResponseHeader.SetCookie)
Dim strRedirectLocation AsString= res.Headers(System.Net.HttpResponseHeader.Location)
Dim result AsNewList(OfString)
IfNot strCookie =NothingThen
result.Add(strCookie)
EndIf
result.Add(strRedirectLocation)
Return result
EndFunction
cookieContainer应用的更多相关文章
- C#保存CookieContainer到文件
摘自:http://licstar.net/archives/6 “C# save CookieContainer to file”,发现了一份优雅的代码.http://stackoverflow.c ...
- C# 将cookiecontainer写到本地
public static void WriteCookiesToDisk(string file, CookieContainer cookieJar) { using(Stream stream ...
- c# 中 利用 CookieContainer 对 Cookie 进行序列化和反序列化校验
private void Form1_Load(object sender, EventArgs e) { var cookieStr = @".CNBlogsCookie=1BE76122 ...
- 带CookieContainer进行post
1.获取CookieContainer ——用户登录 CookieContainer cookie = new CookieContainer(); UserLoginPost("post地 ...
- 一个CookieContainer的拓展类
最近项目中需要频繁用到服务器返回的Cookie,由于项目采用的是HttpClient,并且用CookieContainer自动托管Cookie,在获取Cookie的时候不太方便.所以就写了个拓展类. ...
- 如何将webbrowser控件的Cookie倒入CookieContainer供WebRequest使用
先建一个 "CookieContainer " 把WebBrowser中的Cookie保存在里面 //在WebBrowser中登录 ...
- httpRequest.CookieContainer= cookie 与 httpRequest.Headers.Add("Cookie", cookie)
这两天做了一个获取cookie并且携带此cookie去请求另外一个url地址,中间携带cookie用了两种方式:1. httpRequest.CookieContainer= cookie (此coo ...
- C# HTTP系列4 HttpWebRequest.CookieContainer属性
系列目录 [已更新最新开发文章,点击查看详细] HttpWebRequest.CookieContainer 获取或设置与此请求关联的 Cookie.默认情况下CookieContainer ...
- C#中CookieContainer获取里面cookie值异常:InvokeMember("m_domainTable") FieldAccessException
1.可能是主机提供商的 安全问题. Their hosts works in medium trustsecurity, and ASProxy needs a full trust security ...
随机推荐
- DWZ与KindEditor编辑器的整合
DWZ自带的编辑器是xheditor,可能很多人用不习惯.就像我,习惯用kindeditor了.现在就来说说如何整合dwz和kindeditor. 一.打开DWZ的中的dwz.ui.js,进行修改. ...
- 【Linux C中文函数手册】之 目录操作函数
目录操作函数 1)closedir 关闭目录 相关函数: opendir表头文件: #include<sys/types.h> #include<dirent.h>定义函数: ...
- hive安装配置错误
1.Access denied for user 'hive'@'localhost' (using password: YES) 解决办法: 执行 hive --service metastore ...
- SQL语句统计每天的数据
按用户注册时间统计每天注册的不同来源.不同状态的用户数量: ), RegisterTime, ) RDate ,--DATEPART(YEAR, RegisterTime) 年 ) END 'AWai ...
- UI3_UIbarButtonItem
// // AppDelegate.m // UI3_UIbarButtonItem // // Created by zhangxueming on 15/7/6. // Copyright (c) ...
- (转)IIS7 优化-网站请发并发数
1. 调整IIS 7应用程序池队列长度 由原来的默认1000改为65535. IIS Manager > ApplicationPools > Advanced Settings Queu ...
- 6款基于SVG的HTML5应用和动画
1.HTML5 SVG 3D蝴蝶飞舞动画 逼真超酷 这次我们要分享的这款HTML5动画简直就是逆天,利用SVG制作的3D蝴蝶飞舞动画,蝴蝶飞舞动画非常逼真,蝴蝶飞舞的路线是利用SVG构造的.另外,动画 ...
- MySQL 5.7 Zip 安装(win7)
参考官方文档 http://dev.mysql.com/doc/refman/5.7/en/windows-install-archive.html 2.3.5.1 Extracting the In ...
- 判断Featureclass的类型
一个Featureclass可以是Shapefile Feature Class.Personal Geodatabase Feature Class.File Geodatabase Feature ...
- codevs 3186 队列练习2
3186 队列练习 2 时间限制: 1 s 空间限制: 128000 KB 题目等级 : 黄金 Gold 题解 题目描述 Description (此题与队列练习1相比改了2处:1加 ...