佳木斯湛栽影视文化发展公司

主頁 > 知識(shí)庫 > 解決iis7.5服務(wù)器上.net 獲取不到https頁面的信息

解決iis7.5服務(wù)器上.net 獲取不到https頁面的信息

熱門標(biāo)簽:科大訊飛語音識(shí)別系統(tǒng) 電商新玩法 人工智能 網(wǎng)站排名優(yōu)化 客戶服務(wù) 國美全國運(yùn)營中心 百度AI接口 電銷業(yè)務(wù)

我的獲取頁面需要cookie,不需要的可以去掉;

GET的方法:

復(fù)制代碼 代碼如下:

/// summary>
        /// 獲取URL訪問的HTML內(nèi)容 獲取https 頁面的
        /// /summary>
        /// param name="Url">URL地址/param>
        /// returns>HTML內(nèi)容/returns>
        public static string GetWebContent(string Url, CookieContainer cookieContainer)
        {
            string strResult = "";
            try
            {
                ServicePointManager.Expect100Continue = true;
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(Url);
                request.CookieContainer = cookieContainer;
                request.Timeout = 30000;
                request.Headers.Set("Pragma", "no-cache");

                HttpWebResponse response = (HttpWebResponse)request.GetResponse();
                Stream streamReceive = response.GetResponseStream();

                Encoding encoding = Encoding.GetEncoding("utf-8");
                StreamReader streamReader = new StreamReader(streamReceive, encoding);
                strResult = streamReader.ReadToEnd();
            }
            catch
            {

            }
            return strResult;
        }

 POST的方法:

復(fù)制代碼 代碼如下:

/// summary>
        /// post提交數(shù)據(jù)到https
        /// /summary>
        /// param name="posturl">/param>
        /// param name="postdata">/param>
        /// param name="header">/param>
        /// param name="cookieContainer">/param>
        /// returns>/returns>
        public static string SetPostHtml(string posturl, string postdata, HttpHeader header, CookieContainer cookieContainer)
        {
            string restr = "";
            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3;
            HttpWebRequest request = null;
            HttpWebResponse response = null;
            request = (HttpWebRequest)WebRequest.Create(posturl);
            request.CookieContainer = cookieContainer;
            request.Method = header.method;
            request.Referer = header.Referer;
            request.ContentType = header.contentType;
            byte[] postdatabyte = Encoding.UTF8.GetBytes(postdata);
            request.ContentLength = postdatabyte.Length;
            request.AllowAutoRedirect = false;
            request.KeepAlive = true;
            //提交請(qǐng)求
            Stream stream;
            stream = request.GetRequestStream();
            stream.Write(postdatabyte, 0, postdatabyte.Length);
            stream.Close();
            //接收響應(yīng)
            response = (HttpWebResponse)request.GetResponse();
            using (StreamReader reader = new StreamReader(response.GetResponseStream()))
            {
                restr = reader.ReadToEnd().ToString();
            }
            return restr;
        }

您可能感興趣的文章:
  • IIS 7中如何實(shí)現(xiàn)http重定向https
  • win2003 IIS 6.0實(shí)現(xiàn)全站https訪問的配置方法
  • 有了SSL證書,如何在IIS環(huán)境下部署https
  • startssl申請(qǐng)SSL證書 并且配置 iis 啟用https協(xié)議
  • win2000服務(wù)器在IIS中使用SSL配置HTTPS網(wǎng)站
  • win2003架設(shè)證書服務(wù)器及讓IIS6啟用HTTPS服務(wù)
  • IIS7.0 Windows Server 2008 R2 下配置證書服務(wù)器和HTTPS方式訪問網(wǎng)站的教程圖文詳解
  • IIS7/IIS7.5 URL 重寫 HTTP 重定向到 HTTPS的方法
  • IIS7下配置SSL的方法分析
  • World Wide Web Publishing 服務(wù)嘗試刪除 IIS 所有的 SSL 配置數(shù)據(jù)失敗的幾種方法
  • 在IIS6上開啟https服務(wù)方法分享

標(biāo)簽:POS機(jī) 棗莊 拉薩 南平 咸寧 益陽 攀枝花 廈門

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《解決iis7.5服務(wù)器上.net 獲取不到https頁面的信息》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    潞西市| 宝丰县| 大宁县| 巫山县| 社会| 武胜县| 临西县| 泉州市| 襄垣县| 南岸区| 阜城县| 肇庆市| 丰镇市| 富宁县| 扎囊县| 平潭县| 桂阳县| 鄂州市| 图们市| 河西区| 邵东县| 肥东县| 静海县| 巴塘县| 于都县| 伊宁市| 思南县| 蒙山县| 麦盖提县| 大化| 揭阳市| 宁津县| 阳泉市| 肇东市| 邻水| 从化市| 台前县| 康马县| 光山县| 福海县| 南雄市|