zoukankan      html  css  js  c++  java
  • .NET (c#) 模拟 Cookie

    string postData = "uUsername=avoid&uPassword=123456";
                        ASCIIEncoding encoding = new ASCIIEncoding();
                        byte[] data = encoding.GetBytes(postData);

                        request = (HttpWebRequest)WebRequest.Create(sUrl);
                        request.Method = "POST";
                        request.ContentType = "application/x-www-form-urlencoded";
                        request.ContentLength = data.Length;
                        Stream newStream = request.GetRequestStream();
                        newStream.Write(data, 0, data.Length);

                        newStream.Close();
                       
                        request.CookieContainer = cc;
                       
                        response = (HttpWebResponse)request.GetResponse();
                        cc.Add(response.Cookies);
                        stream = response.GetResponseStream();
                        sHtml = new StreamReader(stream, System.Text.Encoding.Default).ReadToEnd();
            private CookieContainer cc = new CookieContainer();

  • 相关阅读:
    Tree(未解决。。。)
    Fractal(递归,好题)
    Scrambled Polygon(凸多边形,斜率)
    ZYB's Game(博弈)
    Dancing Stars on Me(判断正多边形)
    Hidden String(深搜)
    1043
    TEX Quotes(字符串,水)
    Candy Sharing Game(模拟搜索)
    hpu校赛--雪人的高度(离散化线段树)
  • 原文地址:https://www.cnblogs.com/kenter/p/1599606.html
Copyright © 2011-2022 走看看