SoFunction
Updated on 2025-03-07

httpwebreqeust reads httponly cookie method

httpwebreqeust reads httponly cookie method

Updated: January 25, 2017 09:27:38 Submission: jingxian
Below, the editor will bring you an article about httpwebreqeust to read httponly cookie. The editor thinks it is quite good, so I will share it with you now and give you a reference. Let's take a look with the editor

There is a httpponly cookie, and it will not be retrieved when httpwebreqeust requests. You can directly obtain the set-cookie in the head, and then convert it into a cookie and add it to the cookieContainer.

<pre name="code" class="csharp">string cookieStr = ["Set-Cookie"];
string[] cookstr = (';');
        foreach (string str in cookstr)
        {
            string[] arr = ().Split(',');
            foreach (string str1 in arr)
            {
              if (("=") != -1)
              {
                string[] cookieNameValue = ().Split('=');
                if (cookieNameValue[0] != "Expires" && cookieNameValue[0] != "Domain"
                  && cookieNameValue[0] != "Path")
                {
                  Cookie ck = new Cookie(cookieNameValue[0].Trim().ToString(), cookieNameValue[1].Trim().ToString());
                   = ".";
                  (ck);
                }
              }
            }
        } 


</pre><p></p><pre>

The above method of reading httpwebreqeust for httply cookies is all the content I share with you. I hope you can give you a reference and I hope you can support me more.

  • httponly
  • Read
  • cookie

Related Articles

  • Detailed explanation of c# parallel computing

    This article mainly introduces the simple use of parallel computing, interrupts and jumps in parallel loops, adding items to arrays/sets in parallel loops, returning set operation results/parallel loops containing local variables, PLinq (parallel calculation of Linq) and other related contents.
    2020-12-12
  • Three ways to read database configuration strings in C# in VS

    This article mainly introduces three methods of reading database configuration strings in C# in VS. Friends who need it can refer to it
    2015-10-10
  • Summary of Ruby's method to create array

    In this article, the editor has shared with you the knowledge points about Ruby's array creation method. For those who are interested in the play, please learn it.
    2019-01-01
  • Detailed explanation of generic delegation in c#

    This article mainly introduces generic delegates in C#. It has good reference value, let's take a look with the editor below
    2017-01-01
  • C# combined with JS modification to solve the problem of KindEditor pop-up layer

    KindEditor is an excellent rich text HTML online editor. Here we talk about a problem encountered in use. When deploying to some WEB application projects, when clicking on the similar pop-up layer function, only the mask layer is displayed, while the content layer positioning cannot be displayed correctly. Therefore, this article introduces to you the problem of KindEditor pop-up layer modification combined with JS.
    2024-06-06
  • Socket (socket) communication in C#

    This article introduces Socket (socket) communication in C#, and the article introduces it in detail through sample code. It has certain reference value for everyone's study or work. Friends who need it can refer to it.
    2022-05-05
  • C# calls FFplay to realize video playback function

    This article mainly introduces in detail how C# calls FFplay to realize the video playback function. The sample code in the article is explained in detail and has certain reference value. Friends in need can follow the editor to learn it.
    2023-10-10
  • Implementation of the primary and secondary version numbers of C# assembly

    The version number and secondary version number of the C# assembly are part of the assembly and are used to identify different versions of the assembly. This article mainly introduces the implementation of the main version number and secondary version number of the C# assembly. It has certain reference value. Those who are interested can learn about it.
    2024-04-04
  • Steps to use WordCloudSharp in C# and create word cloud maps

    A previous article introduced the word cloud diagram using Python's jieba and wordcloud libraries. This article introduces how to use the WordCloudSharp library in C# and generate word cloud diagrams. Interested friends can take a look.
    2021-07-07
  • How to implement program to clear aspx page cache

    This article mainly introduces the implementation method of clearing aspx page cache. It is very practical. Friends who need it can refer to it.
    2014-08-08

Latest Comments