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


C# HttpCookieCollection.GetKey方法代码示例

本文整理汇总了C#中System.Web.HttpCookieCollection.GetKey方法的典型用法代码示例。如果您正苦于以下问题:C# HttpCookieCollection.GetKey方法的具体用法?C# HttpCookieCollection.GetKey怎么用?C# HttpCookieCollection.GetKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Web.HttpCookieCollection的用法示例。


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

示例1: Deny_Unrestricted

		public void Deny_Unrestricted ()
		{
			HttpCookieCollection jar = new HttpCookieCollection ();
			jar.Add (biscuit);
			jar.CopyTo (new object[1], 0);
			Assert.IsNull (jar.GetKey (0), "GetKey");
			jar.Remove ("chocolat");
			jar.Set (biscuit);
			Assert.IsNotNull (jar.Get (0), "Get(int)");
			Assert.IsNull (jar.Get ("chocolat"), "Get(string)");
			Assert.IsNotNull (jar[0], "this[int]");
			Assert.IsNull (jar["chocolat"], "this[string]");
			Assert.AreEqual (1, jar.AllKeys.Length, "AllKeys");
			jar.Clear ();
		}
开发者ID:nobled,项目名称:mono,代码行数:15,代码来源:HttpCookieCollectionCas.cs

示例2: ValidateCookieCollection

        private void ValidateCookieCollection(HttpCookieCollection cc) {
            if (GranularValidationEnabled) {
                // Granular request validation is enabled - validate collection entries only as they're accessed.
                cc.EnableGranularValidation((key, value) => ValidateString(value, key, RequestValidationSource.Cookies));
            }
            else {
                // Granular request validation is disabled - eagerly validate all collection entries.
                int c = cc.Count;

                for (int i = 0; i < c; i++) {
                    String key = cc.GetKey(i);
                    String val = cc.Get(i).Value;

                    if (!String.IsNullOrEmpty(val))
                        ValidateString(val, key, RequestValidationSource.Cookies);
                }
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:18,代码来源:HttpRequest.cs

示例3: ValidateCookieCollection

 private void ValidateCookieCollection(HttpCookieCollection cc)
 {
     int count = cc.Count;
     for (int i = 0; i < count; i++)
     {
         string key = cc.GetKey(i);
         string str2 = cc.Get(i).Value;
         if (!string.IsNullOrEmpty(str2))
         {
             this.ValidateString(str2, key, RequestValidationSource.Cookies);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:13,代码来源:HttpRequest.cs

示例4: GenerateCookieKeyPairs

        /// <summary>
        /// Servers the variables.
        /// </summary>
        /// <param name="collection">The collection.</param>
        /// <returns></returns>
        private static string GenerateCookieKeyPairs(HttpCookieCollection collection)
        {
            StringBuilder builder = new StringBuilder();

            for (int index = 0; index < collection.Count; index++)
            {
                builder.AppendLine(string.Format("{0}:{1}", collection.GetKey(index), collection[index]));
            }

            return builder.ToString();
        }
开发者ID:chuckconway,项目名称:chucksoft.core,代码行数:16,代码来源:HttpLogging.cs


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