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


C# IRequest.SetRequestHeaders方法代码示例

本文整理汇总了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
        }
开发者ID:Vertec,项目名称:SignalR,代码行数:34,代码来源:Connection.cs

示例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);
        }
开发者ID:fszlin,项目名称:Nivot.SignalR.Client.Net35,代码行数:13,代码来源:Connection.cs

示例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);
            }
        }
开发者ID:Avatarchik,项目名称:uSignalR,代码行数:14,代码来源:Connection.cs


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