添加自定义标题中的HttpWebRequest [英] Add custom header in HttpWebRequest
本文介绍了添加自定义标题中的HttpWebRequest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要一些定制标题添加到的HttpWebRequest
对象。我如何添加自定义页眉在Windows Phone 7的的HttpWebRequest
对象。
I need to add some custom headers to the HttpWebRequest
object. How can I add Custom Header to HttpWebRequest
object in Windows Phone 7.
推荐答案
您使用标题
属性用于字符串索引:
You use the Headers
property with a string index:
request.Headers["X-My-Custom-Header"] = "the-value";
根据MSDN,现在已经被使用:
According to MSDN, this has been available since:
- 通用Windows平台上4.5
- 的.NET Framework 1.1
- 便携式类库
- 的Silverlight 2.0
- 的Windows Phone的Silverlight 7.0
- 的Windows Phone 8.1
- Universal Windows Platform 4.5
- .NET Framework 1.1
- Portable Class Library
- Silverlight 2.0
- Windows Phone Silverlight 7.0
- Windows Phone 8.1
的 https://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.headers(v = vs.110)的.aspx
这篇关于添加自定义标题中的HttpWebRequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文