OpenReadWithHttps
///<summary>
///采用https协议访问网络
///</summary>
///<param name="URL">url地址</param>
///<param name="strPostdata">发送的数据</param>
///<returns></returns>
public string OpenReadWithHttps(string URL, string strPostdata)
{
Encoding encoding = Encoding.Default;
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(URL);
request.Method = "post";
request.Accept = "text/html, application/xhtml+xml, */*";
request.ContentType = "application/x-www-form-urlencoded";
CookieContainer objcok = new CookieContainer();
objcok.Add(new Uri("http://sufei.cnblogs.com"), new Cookie("键", "值"));
objcok.Add(new Uri("http://sufei.cnblogs.com"), new Cookie("键", "值"));
objcok.Add(new Uri("http://sufei.cnblogs.com"), new Cookie("sidi_sessionid", "360A748941D055BEE8C960168C3D4233"));
request.CookieContainer = objcok;
byte[] buffer = encoding.GetBytes(strPostdata);
request.ContentLength = buffer.Length;
request.GetRequestStream().Write(buffer, 0, buffer.Length);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();
StreamReader reader = new StreamReader(response.GetResponseStream(), System.Text.Encoding.GetEncoding("utf-8"));
return reader.ReadToEnd();
}
OpenReadWithHttps的更多相关文章
- c# HttpWebRequest 与 HttpWebResponse
如果你想做一些,抓取,或者是自动获取的功能,那么就跟我一起来学习一下Http请求吧.本文章会对Http请求时的Get和Post方式进行详细的说明,在请求时的参数怎么发送,怎么带Cookie,怎么设置证 ...
- C# HttpWebRequest 绝技 根据URL地址获取网页信息
如果要使用中间的方法的话,可以访问我的帮助类完全免费开源:C# HttpHelper,帮助类,真正的Httprequest请求时无视编码,无视证书,无视Cookie,网页抓取 1.第一招,根据URL地 ...
- C#、.NET网络请求总结(WebClient和WebRequest)
1.关于WebClient第三方的封装,支持多文件上传等 using System; using System.Collections.Generic; using System.Text; usin ...
- C# HttpWebRequest 绝技 转至 http://www.sufeinet.com/
转至: 在线测试工具http://www.sufeinet.com/thread-3690-1-1.htmlc# HttpWebRequest与HttpWebResponse 绝技 如果你想做一 ...
- C#_抓包HttpWebRequest跟HttpWebResponse
1.第一招,根据URL地址获取网页信息 这招是入门第一式, 特点: 1.最简单最直观的一种,入门课程. 2.适应于明文,无需登录,无需任何验证就可以进入的页面. 3.获取的数据类型为HTML文档. ...
- c# HttpWebRequest与HttpWebResponse(转)
如果你想做一些,抓取,或者是自动获取的功能,那么就跟我一起来学习一下Http请求吧.本文章会对Http请求时的Get和Post方式进行详细的说明,在请求时的参数怎么发送,怎么带Cookie,怎么设置证 ...
- HttpWebRequest和HttpWebResponse
原文:http://blog.csdn.net/haitaofeiyang/article/details/18362225 申公前几日和一个客户做系统对接,以前和客户对接一般采用webservice ...
- c# HttpWebRequest与HttpWebResponse 绝技(转载)
c# HttpWebRequest与HttpWebResponse 绝技 如果你想做一些,抓取,或者是自动获取的功能,那么就跟我一起来学习一下Http请求吧.本文章会对Http请求时的Get和P ...
- 接口post +json +bean
public ReturnBean<DealBean> getMember(String tagtype, String tag) { try { String requestUrl = ...
随机推荐
- [tsinsen_A1278]串珠子
[tsinsen_A1278]串珠子 试题描述 铭铭有 \(n\) 个十分漂亮的珠子和若干根颜色不同的绳子.现在铭铭想用绳子把所有的珠子连接成一个整体. 现在已知所有珠子互不相同,用整数 \(1\) ...
- python的get和post
postimport urlliimport urllib #post数据value = {}value['username']='aaaa'value['password']='123123'dat ...
- 洛谷 [P3723] 礼物
FFT https://www.luogu.org/problemnew/solution/P3723 重点在于构造卷积的形式 #include <iostream> #include & ...
- HDOJ 2222: Keywords Search
Keywords Search Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others ...
- 洛谷P2114起床困难综合征
从高位到低位按位枚举,贪心.如果该位填1比填0结果优且填1不会超出m限制,那就填1,否则填0 /*by SilverN*/ #include<iostream> #include<c ...
- POJ 1236 Network of Schools Tarjan缩点
Network of Schools Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22729 Accepted: 89 ...
- FOR XML PATH 语句的应用【所有列值显示在一行中】
原文发布时间为:2010-10-20 -- 来源于本人的百度文章 [由搬家工具导入] 大家都知道在SQL Server中利用 FOR XML PATH 语句能够把查询的数据生成XML数据,下面是它的一 ...
- jquery.slider jquery滑块插件
原文发布时间为:2011-03-08 -- 来源于本人的百度文章 [由搬家工具导入] http://jqueryui.com/demos/slider jquery滑块插件
- Day 29 process&thread_1
进程和线程 1 进程(process): 1.定义: 最小的执行单元.进程就是一个程序在一个数据集上的一次动态执行过程. 进程一般由程序.数据集.进程控制块三部分组成: 我们编写的程序用来描述进程要完 ...
- MySQL冗余数据的三种方案
一,为什么要冗余数据 互联网数据量很大的业务场景,往往数据库需要进行水平切分来降低单库数据量. 水平切分会有一个patition key,通过patition key的查询能够直接定位到库,但是非pa ...