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


C# HttpRequestHeader类代码示例

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


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


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