• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# HttpRequestHeader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1:

 // Properties
 public string this[HttpRequestHeader reqHeader]
 {
     get
     {
         return HeaderStrings[(int)reqHeader];
     }
 }
开发者ID:modulexcite,项目名称:IL2JS,代码行数:8,代码来源:HttpRequestHeaderEnumToName.cs


示例2: BuildWebRequest_RestrictedTypes_AddsCorrectHeader

        public void BuildWebRequest_RestrictedTypes_AddsCorrectHeader(HttpRequestHeader header, string value)
        {
            request.AddHeader(header, value);

            var webrequest = HttpWebRequestBuilder.BuildFrom(request);

            Assert.That(webrequest.Headers[header], Is.Not.Null);
        }
开发者ID:chenzuo,项目名称:HttpGhost,代码行数:8,代码来源:HttpWebRequestBuilderTests.cs


示例3: ToString

 private static string ToString(HttpRequestHeader value)
 {
     switch (value)
     {
         case HttpRequestHeader.CacheControl:
             return "Cache-Control";
         case HttpRequestHeader.KeepAlive:
             return "Keep-Alive";
         case HttpRequestHeader.TransferEncoding:
             return "Transfer-Encoding";
         case HttpRequestHeader.ContentLength:
             return "Content-Length";
         case HttpRequestHeader.ContentType:
             return "Content-Type";
         case HttpRequestHeader.ContentEncoding:
             return "Content-Encoding";
         case HttpRequestHeader.ContentLanguage:
             return "Content-Language";
         case HttpRequestHeader.ContentLocation:
             return "Content-Location";
         case HttpRequestHeader.ContentMd5:
             return "Content-MD5";
         case HttpRequestHeader.ContentRange:
             return "Content-Range";
         case HttpRequestHeader.LastModified:
             return "Last-Modified";
         case HttpRequestHeader.AcceptCharset:
             return "Accept-Charset";
         case HttpRequestHeader.AcceptEncoding:
             return "Accept-Encoding";
         case HttpRequestHeader.AcceptLanguage:
             return "Accept-Language";
         case HttpRequestHeader.IfMatch:
             return "If-Match";
         case HttpRequestHeader.IfModifiedSince:
             return "If-Modified-Since";
         case HttpRequestHeader.IfNoneMatch:
             return "If-None-Match";
         case HttpRequestHeader.IfRange:
             return "If-Range";
         case HttpRequestHeader.IfUnmodifiedSince:
             return "If-Unmodified-Since";
         case HttpRequestHeader.MaxForwards:
             return "Max-Forwards";
         case HttpRequestHeader.ProxyAuthorization:
             return "Proxy-Authorization";
         case HttpRequestHeader.UserAgent:
             return "User-Agent";
         default:
             return value.ToString();
     }
 }
开发者ID:lstefano71,项目名称:SharpExpress,代码行数:52,代码来源:HttpExtensions.cs


示例4: InvalidOperationException

 public string this[HttpRequestHeader header]
 {
     get
     {
         if (!AllowHttpRequestHeader)
         {
             throw new InvalidOperationException(SR.net_headers_req);
         }
         return this[header.GetName()];
     }
     set
     {
         if (!AllowHttpRequestHeader)
         {
             throw new InvalidOperationException(SR.net_headers_req);
         }
         this[header.GetName()] = value;
     }
 }
开发者ID:ESgarbi,项目名称:corefx,代码行数:19,代码来源:WebHeaderCollection.cs


示例5: IsValidHeader

		bool IsValidHeader (HttpRequestHeader header)
		{
			switch (header) {
			case HttpRequestHeader.Connection:
			case HttpRequestHeader.Date:
			case HttpRequestHeader.KeepAlive:
			case HttpRequestHeader.Trailer:
			case HttpRequestHeader.TransferEncoding:
			case HttpRequestHeader.Upgrade:
			case HttpRequestHeader.Via:
			case HttpRequestHeader.Warning:
			case HttpRequestHeader.Allow:
			case HttpRequestHeader.ContentLength:
			case HttpRequestHeader.ContentType:
			case HttpRequestHeader.ContentLocation:
			case HttpRequestHeader.ContentRange:
			case HttpRequestHeader.LastModified:
			case HttpRequestHeader.Accept:
			case HttpRequestHeader.AcceptCharset:
			case HttpRequestHeader.AcceptEncoding:
			case HttpRequestHeader.AcceptLanguage:
			// Authorization was not valid before SL4
			// case HttpRequestHeader.Authorization:
			case HttpRequestHeader.Cookie:
			case HttpRequestHeader.Expect:
			case HttpRequestHeader.Host:
			case HttpRequestHeader.IfModifiedSince:
			case HttpRequestHeader.MaxForwards:
			// ProxyAuthorization was not valid before SL4
			// case HttpRequestHeader.ProxyAuthorization:
			case HttpRequestHeader.Referer:
			case HttpRequestHeader.Te:
			// Range was not valid in SL2 but is accepted in SL3
			// case HttpRequestHeader.Range:
			case HttpRequestHeader.UserAgent:
				return false;
			default:
				return true;
			}
		}
开发者ID:dfr0,项目名称:moon,代码行数:40,代码来源:BaseHttpWebRequestTest.cs


示例6: Get

		public string this[HttpRequestHeader hrh]
		{
			get {
				return Get (RequestHeaderToString (hrh));
			}
			
			set {
				Add (RequestHeaderToString (hrh), value);
			}
		}
开发者ID:runefs,项目名称:Marvin,代码行数:10,代码来源:WebHeaderCollection.cs


示例7: RequestHeaderToString

		string RequestHeaderToString (HttpRequestHeader value)
		{
			switch (value){
			case HttpRequestHeader.CacheControl:
				return "cache-control";
			case HttpRequestHeader.Connection:
				return "connection";
			case HttpRequestHeader.Date:
				return "date";
			case HttpRequestHeader.KeepAlive:
				return "keep-alive";
			case HttpRequestHeader.Pragma:
				return "pragma";
			case HttpRequestHeader.Trailer:
				return "trailer";
			case HttpRequestHeader.TransferEncoding:
				return "transfer-encoding";
			case HttpRequestHeader.Upgrade:
				return "upgrade";
			case HttpRequestHeader.Via:
				return "via";
			case HttpRequestHeader.Warning:
				return "warning";
			case HttpRequestHeader.Allow:
				return "allow";
			case HttpRequestHeader.ContentLength:
				return "content-length";
			case HttpRequestHeader.ContentType:
				return "content-type";
			case HttpRequestHeader.ContentEncoding:
				return "content-encoding";
			case HttpRequestHeader.ContentLanguage:
				return "content-language";
			case HttpRequestHeader.ContentLocation:
				return "content-location";
			case HttpRequestHeader.ContentMd5:
				return "content-md5";
			case HttpRequestHeader.ContentRange:
				return "content-range";
			case HttpRequestHeader.Expires:
				return "expires";
			case HttpRequestHeader.LastModified:
				return "last-modified";
			case HttpRequestHeader.Accept:
				return "accept";
			case HttpRequestHeader.AcceptCharset:
				return "accept-charset";
			case HttpRequestHeader.AcceptEncoding:
				return "accept-encoding";
			case HttpRequestHeader.AcceptLanguage:
				return "accept-language";
			case HttpRequestHeader.Authorization:
				return "authorization";
			case HttpRequestHeader.Cookie:
				return "cookie";
			case HttpRequestHeader.Expect:
				return "expect";
			case HttpRequestHeader.From:
				return "from";
			case HttpRequestHeader.Host:
				return "host";
			case HttpRequestHeader.IfMatch:
				return "if-match";
			case HttpRequestHeader.IfModifiedSince:
				return "if-modified-since";
			case HttpRequestHeader.IfNoneMatch:
				return "if-none-match";
			case HttpRequestHeader.IfRange:
				return "if-range";
			case HttpRequestHeader.IfUnmodifiedSince:
				return "if-unmodified-since";
			case HttpRequestHeader.MaxForwards:
				return "max-forwards";
			case HttpRequestHeader.ProxyAuthorization:
				return "proxy-authorization";
			case HttpRequestHeader.Referer:
				return "referer";
			case HttpRequestHeader.Range:
				return "range";
			case HttpRequestHeader.Te:
				return "te";
			case HttpRequestHeader.Translate:
				return "translate";
			case HttpRequestHeader.UserAgent:
				return "user-agent";
			default:
				throw new InvalidOperationException ();
			}
		}
开发者ID:runefs,项目名称:Marvin,代码行数:89,代码来源:WebHeaderCollection.cs


示例8: AddHeader

 public void AddHeader(HttpRequestHeader headerType, string value)
 {
     _headers.Add(headerType, value);
 }
开发者ID:Huddle,项目名称:dynamicrest,代码行数:4,代码来源:HttpVerbRequestBuilder.cs


示例9: SetHeaderValue

 private void SetHeaderValue(HttpRequestHeader name, string value)
 {
     if (value != null)
     {
         _headers[name] = value;
     }
     else
     {
         _headers.Remove(name);
     }
 }
开发者ID:kodefuguru,项目名称:SDataCSharpClientLib,代码行数:11,代码来源:MimePart.cs


示例10: GetKnownHeader

 private string GetKnownHeader(HttpRequestHeader header)
 {
     return Interop.HttpApi.GetKnownHeader(RequestBuffer, OriginalBlobAddress, (int)header);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:4,代码来源:HttpListenerRequest.Windows.cs


示例11: HeaderValueAttribute

 public HeaderValueAttribute(HttpRequestHeader header)
 {
     _headerName = HttpRequestHeaders.HeaderNameFor(header);
 }
开发者ID:roend83,项目名称:fubumvc,代码行数:4,代码来源:HeaderValueAttribute.cs


示例12: Add

 public static void Add(this WebHeaderCollection col, HttpRequestHeader key, string value)
 {
     col[key] = value;
 }
开发者ID:mderazon,项目名称:dobberman,代码行数:4,代码来源:WebHeaderCollectionExtensions.cs


示例13: Add

 public void Add(HttpRequestHeader header, string value) { }
开发者ID:naamunds,项目名称:corefx,代码行数:1,代码来源:System.Net.WebHeaderCollection.cs


示例14: Remove

 public void Remove(HttpRequestHeader header) { }
开发者ID:naamunds,项目名称:corefx,代码行数:1,代码来源:System.Net.WebHeaderCollection.cs


示例15: HttpRequestHeaderToString

		public string this [HttpRequestHeader header] {
			get { return this [HttpRequestHeaderToString (header)]; }
			set {
				string h = HttpRequestHeaderToString (header);
				if (validate)
					ValidateHeader (h);
				headers [h] = value;
			}
		}
开发者ID:nlhepler,项目名称:mono,代码行数:9,代码来源:WebHeaderCollection_2_1.cs


示例16: Convert

 internal static string Convert(HttpRequestHeader header)
 {
     return Convert (header.ToString ());
 }
开发者ID:NIAEFEUP,项目名称:Kommando,代码行数:4,代码来源:WebHeaderCollection.cs


示例17: Add

 internal static void Add(this WebHeaderCollection collection, HttpRequestHeader header, string value)
 {
     collection[header] = value;
 }
开发者ID:RobertiF,项目名称:Dynamo,代码行数:4,代码来源:HttpWebRequester.cs


示例18: Remove

 /// <summary>
 /// Removes the specified header from the collection.
 /// </summary>
 /// <param name="header">
 /// A <see cref="HttpRequestHeader"/> to remove from the collection.
 /// </param>
 /// <exception cref="InvalidOperationException">
 /// The current <see cref="WebHeaderCollection"/> instance does not allow any of <see cref="HttpRequestHeader"/> values.
 /// </exception>
 /// <exception cref="ArgumentException">
 /// <paramref name="header"/> is a restricted header.
 /// </exception>
 public void Remove(HttpRequestHeader header)
 {
     DoWithCheckingState (RemoveWithoutCheckingName, Convert (header), null, false, false);
 }
开发者ID:NIAEFEUP,项目名称:Kommando,代码行数:16,代码来源:WebHeaderCollection.cs


示例19: Set

 /// <summary>
 /// Sets the specified header to the specified value.
 /// </summary>
 /// <param name="header">
 /// A <see cref="HttpRequestHeader"/> to set.
 /// </param>
 /// <param name="value">
 /// A <see cref="string"/> that contains the value of the header to set.
 /// </param>
 /// <exception cref="InvalidOperationException">
 /// The current <see cref="WebHeaderCollection"/> instance does not allow any of <see cref="HttpRequestHeader"/> values.
 /// </exception>
 /// <exception cref="ArgumentException">
 ///   <para>
 ///   <paramref name="header"/> is a restricted header.
 ///   </para>
 ///   <para>
 ///   -or-
 ///   </para>
 ///   <para>
 ///   <paramref name="value"/> contains invalid characters.
 ///   </para>
 /// </exception>
 /// <exception cref="ArgumentOutOfRangeException">
 /// The length of <paramref name="value"/> is greater than 65535.
 /// </exception>
 public void Set(HttpRequestHeader header, string value)
 {
     DoWithCheckingState (SetWithoutCheckingName, Convert (header), value, false, true);
 }
开发者ID:NIAEFEUP,项目名称:Kommando,代码行数:30,代码来源:WebHeaderCollection.cs


示例20: GetRequestHeaderName

 // Public methods.
 /// <summary>
 /// Returns the name of the specified request header.
 /// </summary>
 /// <param name="header">The HTTP request header.</param>
 /// <returns>The header name.</returns>
 public static string GetRequestHeaderName(HttpRequestHeader header)
 {
     return HttpUtils.requestHeaderNames[header] as string;
 }
开发者ID:alexbikfalvi,项目名称:DotNetApi,代码行数:10,代码来源:HttpUtils.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# HttpRequestHeaderHelper类代码示例发布时间:2022-05-24
下一篇:
C# HttpRequest类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap