当前位置: 首页>>代码示例>>C#>>正文


C# WebHeaderCollection类代码示例

本文整理汇总了C#中WebHeaderCollection的典型用法代码示例。如果您正苦于以下问题:C# WebHeaderCollection类的具体用法?C# WebHeaderCollection怎么用?C# WebHeaderCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


WebHeaderCollection类属于命名空间,在下文中一共展示了WebHeaderCollection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ChunkStream

		public ChunkStream (WebHeaderCollection headers)
		{
			this.headers = headers;
			saved = new StringBuilder ();
			chunks = new ArrayList ();
			chunkSize = -1;
		}
开发者ID:transformersprimeabcxyz,项目名称:mono.net.httplistener,代码行数:7,代码来源:ChunkStream.cs

示例2: HttpRequestHeader_GetKey_Success

 public void HttpRequestHeader_GetKey_Success()
 {
     WebHeaderCollection w = new WebHeaderCollection();
     w.Add("header1", "value1");
     w.Add("header1", "value2");
     Assert.NotEmpty(w.GetKey(0));
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:WebHeaderCollectionTest.netstandard17.cs

示例3: HttpListenerRequest

		internal HttpListenerRequest (HttpListenerContext context)
		{
			this.context = context;
			headers = new WebHeaderCollection ();
			input_stream = Stream.Null;
			version = HttpVersion.Version10;
		}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:7,代码来源:HttpListenerRequest.cs

示例4: ChunkStream

 public ChunkStream(WebHeaderCollection headers)
 {
     _headers = headers;
       _chunkSize = -1;
       _chunks = new List<Chunk> ();
       _saved = new StringBuilder ();
 }
开发者ID:pedro-ramirez-suarez,项目名称:DiPS,代码行数:7,代码来源:ChunkStream.cs

示例5: HeaderInfo

    public static WebHeaderCollection HeaderInfo(String str)
    {
        WebHeaderCollection CC = new WebHeaderCollection();
        HttpWebRequest Req = (HttpWebRequest)WebRequest.Create(str);
        Req.Proxy = null;
        Req.UseDefaultCredentials = true;
        //YOU MUST ASSIGN A COOKIE CONTAINER FOR THE REQUEST TO PULL THE COOKIES
        //Req.Headers = CC;
        HttpWebResponse Res = (HttpWebResponse)Req.GetResponse();
        //DUMP THE COOKIES
        Console.WriteLine("----- HEADERS -----");
        if(Res.Headers != null &&  Res.Headers.Count != 0)
        {

            foreach (string key in Res.Headers)
            {
                Console.WriteLine("\t" + key.ToString() + "\t" + Res.Headers[key]);
            }
        }
        else
        {
            Console.WriteLine("No Headers");
        }
        return Res.Headers;
    }
开发者ID:leon4422,项目名称:Neilson-Tag,代码行数:25,代码来源:WebFetch.cs

示例6: write

 static void write(WebHeaderCollection headers)
 {
     for (int index = 0; index < headers.Count; index++) {
         Console.WriteLine("{0}: {1}", headers.Keys[index], headers[index]);
     }
     Console.WriteLine("");
 }
开发者ID:weaver,项目名称:scribbles,代码行数:7,代码来源:03-curl.cs

示例7: HttpRequestHeader_ToByteArray_Success

 public void HttpRequestHeader_ToByteArray_Success()
 {
     WebHeaderCollection w = new WebHeaderCollection();
     w.Add("header1", "value1");
     w.Add("header1", "value2");
     byte[] byteArr = w.ToByteArray();
     Assert.NotEmpty(byteArr);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:8,代码来源:WebHeaderCollectionTest.netstandard17.cs

示例8: HttpRequest_AddQuery_CommonHeader_Success

        public void HttpRequest_AddQuery_CommonHeader_Success()
        {
            string headerValue = "value123";
            WebHeaderCollection w = new WebHeaderCollection();
            w[HttpRequestHeader.Accept] = headerValue;

            Assert.Equal(headerValue, w[HttpRequestHeader.Accept]);
        }
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:8,代码来源:WebHeaderCollectionTest.cs

示例9: DefaultPropertyValues_ReturnEmptyAfterConstruction_Success

 public void DefaultPropertyValues_ReturnEmptyAfterConstruction_Success()
 {
     WebHeaderCollection w = new WebHeaderCollection();
     Assert.Equal(0, w.AllKeys.Length);
     Assert.Equal(0, w.Count);
     Assert.Equal("\r\n", w.ToString());
     Assert.Empty(w);
 }
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:8,代码来源:WebHeaderCollectionTest.cs

示例10: HttpRequestHeader_Get_Success

 public void HttpRequestHeader_Get_Success()
 {
     WebHeaderCollection w = new WebHeaderCollection();
     w.Add("header1", "value1");
     w.Add("header1", "value2");
     string[] values = w.GetValues(0);
     Assert.Equal("value1", values[0]);
     Assert.Equal("value2", values[1]);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:9,代码来源:WebHeaderCollectionTest.netstandard17.cs

示例11: HttpRequestHeader_Add_Success

        public void HttpRequestHeader_Add_Success()
        {
            WebHeaderCollection w = new WebHeaderCollection();
            w[HttpRequestHeader.Connection] = "keep-alive";

            Assert.Equal(1, w.Count);
            Assert.Equal("keep-alive", w[HttpRequestHeader.Connection]);
            Assert.Equal("Connection", w.AllKeys[0]);
        }
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:9,代码来源:WebHeaderCollectionTest.cs

示例12: HttpResponseHeader_AddQuery_CommonHeader_Success

        public void HttpResponseHeader_AddQuery_CommonHeader_Success()
        {
            string headerValue = "value123";
            WebHeaderCollection w = new WebHeaderCollection();
            w[HttpResponseHeader.ProxyAuthenticate] = headerValue;
            w[HttpResponseHeader.WwwAuthenticate] = headerValue;

            Assert.Equal(headerValue, w[HttpResponseHeader.ProxyAuthenticate]);
            Assert.Equal(headerValue, w[HttpResponseHeader.WwwAuthenticate]);
        }
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:10,代码来源:WebHeaderCollectionTest.cs

示例13: CustomHeader_AddQuery_Success

        public void CustomHeader_AddQuery_Success()
        {
            string customHeader = "Custom-Header";
            string customValue = "Custom;.-Value";
            WebHeaderCollection w = new WebHeaderCollection();
            w[customHeader] = customValue;

            Assert.Equal(1, w.Count);
            Assert.Equal(customValue, w[customHeader]);
            Assert.Equal(customHeader, w.AllKeys[0]);
        }
开发者ID:shiftkey-tester,项目名称:corefx,代码行数:11,代码来源:WebHeaderCollectionTest.cs

示例14: HttpRequestHeader_Add_Remove_Success

        public void HttpRequestHeader_Add_Remove_Success()
        {
            WebHeaderCollection w = new WebHeaderCollection();
            w.Add(HttpRequestHeader.Warning, "Warning1");

            Assert.Equal(1, w.Count);
            Assert.Equal("Warning1", w[HttpRequestHeader.Warning]);
            Assert.Equal("Warning", w.AllKeys[0]);

            w.Remove(HttpRequestHeader.Warning);
            Assert.Equal(0, w.Count);
        }
开发者ID:dotnet,项目名称:corefx,代码行数:12,代码来源:WebHeaderCollectionTest.netstandard17.cs

示例15: SerializeDeserialize_Roundtrip_MemberData

 public static IEnumerable<object[]> SerializeDeserialize_Roundtrip_MemberData()
 {
     for (int i = 0; i < 10; i++)
     {
         var wc = new WebHeaderCollection();
         for (int j = 0; j < i; j++)
         {
             wc[$"header{j}"] = $"value{j}";
         }
         yield return new object[] { wc };
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:12,代码来源:WebHeaderCollectionTest.netstandard17.cs


注:本文中的WebHeaderCollection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。