本文整理汇总了C#中IRequest.SetRequestHeaders方法的典型用法代码示例。如果您正苦于以下问题:C# IRequest.SetRequestHeaders方法的具体用法?C# IRequest.SetRequestHeaders怎么用?C# IRequest.SetRequestHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRequest
的用法示例。
在下文中一共展示了IRequest.SetRequestHeaders方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateUserAgentString
void IConnection.PrepareRequest(IRequest request)
{
#if WINDOWS_PHONE
// http://msdn.microsoft.com/en-us/library/ff637320(VS.95).aspx
request.UserAgent = CreateUserAgentString("SignalR.Client.WP7");
#else
#if SILVERLIGHT
// Useragent is not possible to set with Silverlight, not on the UserAgent property of the request nor in the Headers key/value in the request
#else
request.UserAgent = CreateUserAgentString("SignalR.Client");
#endif
#endif
if (Credentials != null)
{
request.Credentials = Credentials;
}
if (CookieContainer != null)
{
request.CookieContainer = CookieContainer;
}
#if !SILVERLIGHT
if (Proxy != null)
{
request.Proxy = Proxy;
}
#endif
request.SetRequestHeaders(Headers);
#if (NET4 || NET45)
request.AddClientCerts(certCollection);
#endif
}
示例2: CreateUserAgentString
void IConnection.PrepareRequest(IRequest request)
{
#if PORTABLE
// Cannot set user agent for Portable because SL does not support it.
#elif NETFX_CORE
request.UserAgent = CreateUserAgentString("SignalR.Client.WinRT");
#elif NET45
request.UserAgent = CreateUserAgentString("SignalR.Client.NET45");
#else
request.UserAgent = CreateUserAgentString("SignalR.Client.NET4");
#endif
request.SetRequestHeaders(Headers);
}
示例3: CreateUserAgentString
void IConnection.PrepareRequest(IRequest request)
{
request.UserAgent = CreateUserAgentString("SignalR.Client");
if (Credentials != null)
request.Credentials = Credentials;
if (CookieContainer != null)
request.CookieContainer = CookieContainer;
if (Headers.Count > 0)
{
request.SetRequestHeaders(Headers);
}
}