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


C# WebHeaderCollection.Set方法代码示例

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


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

示例1: VerifyHeaderIsLegal

        private bool VerifyHeaderIsLegal(WebHeaderCollection wrc, string header, string content, Type exceptionType)
        {
            bool res = true;

            try
            {
                Log.Comment("Set Headers Properties for header: '" + header + "', with value: '" + content + "'");

                wrc.Set(header, content);

            }
            catch (Exception ex)
            {
                Log.Exception("Exception thrown for legal header: '" + header + "'", ex);
                res = false;
            }

            return res;
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:19,代码来源:HttpKnownHeaderNamesTests.cs

示例2: VerifyHeaderIsIllegal

        private bool VerifyHeaderIsIllegal( WebHeaderCollection wrc, string header, string content, Type exceptionType )
        {
            bool res = true;

            try
            {
                Log.Comment("Set Headers Properties for header: '" + header + "', with value: '" + content + "'");
                
                wrc.Set(header, content);
                Log.Comment("Illegal header was set:  Failed.");
                res = false;
            }
            catch (Exception ex)
            {
                if (!HttpTests.ValidateException(ex, exceptionType))
                {
                    res = false;
                }
            } 

            return res;
        }
开发者ID:aura1213,项目名称:netmf-interpreter,代码行数:22,代码来源:HttpKnownHeaderNamesTests.cs

示例3: GetWebHeaderCollection

 public static WebHeaderCollection GetWebHeaderCollection(Dictionary<string, string> parameters)
 {
     var headers = new WebHeaderCollection();
     foreach (var pair in parameters)
     {
         headers.Set(pair.Key, pair.Value);
     }
     return headers;
 }
开发者ID:sillsdev,项目名称:chack,代码行数:9,代码来源:HgResumeTestUtilities.cs

示例4: Request

        private JObject Request(string host, string relativeUrl, IDictionary<string, string> post_params)
        {
            string uri = String.Format("https://{0}{1}", host, relativeUrl);
            string clientDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
            string auth = GetAuthCode(host, relativeUrl, clientDate, post_params);

            // Custom Headers
            var customHeaders = new WebHeaderCollection();
            if (Plattform == QuizDuellPlattform.ANDROID) { customHeaders.Set("dt", "a"); }
            if (Plattform == QuizDuellPlattform.ANDROID) { customHeaders.Set("Accept-Encoding", "identity"); }
            customHeaders.Set("Authorization", auth);
            customHeaders.Set("clientdate", clientDate);

            string responseText = "{}";
            if (post_params != null)
            {
                // Post Request
                string postData = DictionaryToPostDataString(post_params);
                responseText = Client.MakeRequest(uri, "", postData, customHeaders);
            }
            else
            {
                // Get Request
                responseText = Client.MakeRequest(uri, "", customHeaders);
            }

            // Make sure that we have a valid JSON Object
            if (responseText == null || responseText.Contains("ACCESS NOT OK") || responseText.Contains("Error"))
            {
                // responseText = "{\"error\": \"ACCESS NOT OK\"}";
                responseText = "{\"error\": \"" + responseText + "\"}";
            }

            var jObject = JObject.Parse(responseText);
            return jObject;
        }
开发者ID:ultrasilencer,项目名称:QuizDuell,代码行数:36,代码来源:QuizDuellApi.cs

示例5: AddHeaders

 /// <summary>
 /// Allows the subclasses to add their own header information
 /// </summary>
 /// <param name="webHeaderCollection">The HTTP request headers</param>
 internal virtual void AddHeaders(WebHeaderCollection webHeaderCollection)
 {
     if (!string.IsNullOrEmpty(this.AnchorMailbox))
     {
         webHeaderCollection.Set(AnchorMailboxHeaderName, this.AnchorMailbox);
         webHeaderCollection.Set(ExplicitLogonUserHeaderName, this.AnchorMailbox);
     }
 }
开发者ID:XavierDa,项目名称:ews-managed-api,代码行数:12,代码来源:ServiceRequestBase.cs


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