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


C# Authenticator.CreateHttpWebRequest方法代码示例

本文整理汇总了C#中Authenticator.CreateHttpWebRequest方法的典型用法代码示例。如果您正苦于以下问题:C# Authenticator.CreateHttpWebRequest方法的具体用法?C# Authenticator.CreateHttpWebRequest怎么用?C# Authenticator.CreateHttpWebRequest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Authenticator的用法示例。


在下文中一共展示了Authenticator.CreateHttpWebRequest方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrepareRequest

        private HttpWebRequest PrepareRequest(Uri target,
            Authenticator authentication,
            string slug,
            string contentType,
            long contentLength,
            string httpMethod) {
            HttpWebRequest request = authentication.CreateHttpWebRequest(httpMethod, target);
            request.Headers.Add(GDataRequestFactory.SlugHeader + ": " + slug);
            request.Headers.Add(GDataRequestFactory.ContentOverrideHeader + ": " + contentType);
            if (contentLength != -1) {
                request.Headers.Add(GDataRequestFactory.ContentLengthOverrideHeader + ": " + contentLength);
            }

            return request;
        }
开发者ID:jamesjbigler,项目名称:googleReaderShares2Blogger,代码行数:15,代码来源:resumableupload.cs

示例2: QueryStatus

        /// <summary>
        ///  askes the server about the current status
        /// </summary>
        /// <param name="authentication"></param>
        /// <param name="targetUri"></param>
        /// <returns></returns>
        public static long QueryStatus(Authenticator authentication, Uri targetUri) {
            HttpWebRequest request = authentication.CreateHttpWebRequest(HttpMethods.Post, targetUri);
            long result = -1;

            // add a range header
            string contentRange = String.Format("bytes */*");
            request.Headers.Add(HttpRequestHeader.ContentRange, contentRange);
            request.ContentLength = 0;
            HttpWebResponse response = request.GetResponse() as HttpWebResponse;

            // now parse the header
            string range = response.Headers["Range"];
            string[] parts = range.Split('-');

            if (parts.Length > 1 && parts[1] != null) {
                result = long.Parse(parts[1]);
            }

            return result;
        }
开发者ID:jamesjbigler,项目名称:googleReaderShares2Blogger,代码行数:26,代码来源:resumableupload.cs

示例3: UploadStreamPart

        private HttpWebResponse UploadStreamPart(int partIndex, string httpMethod, Uri sessionUri,
            Authenticator authentication, Stream payload, string mediaType, AsyncData data) {
            HttpWebRequest request = authentication.CreateHttpWebRequest(httpMethod, sessionUri);
            request.AllowWriteStreamBuffering = false;
            request.Timeout = 600000;

            // write the data
            request.ContentType = mediaType;
            CopyData(payload, request, partIndex, data, sessionUri);

            HttpWebResponse response = request.GetResponse() as HttpWebResponse;
            return response;
        }
开发者ID:jamesjbigler,项目名称:googleReaderShares2Blogger,代码行数:13,代码来源:resumableupload.cs

示例4: PrepareRequest

        private HttpWebRequest PrepareRequest(Uri target,
            Authenticator authentication,
            string slug,
            string contentType,
            long contentLength,
            string httpMethod) {
            HttpWebRequest request = authentication.CreateHttpWebRequest(httpMethod, target);
            request.Headers.Set(GDataRequestFactory.SlugHeader, Utilities.EncodeSlugHeader(slug));
            request.Headers.Set(GDataRequestFactory.ContentOverrideHeader, contentType);
            if (contentLength != -1) {
                request.Headers.Set(GDataRequestFactory.ContentLengthOverrideHeader, contentLength.ToString());
            }

            return request;
        }
开发者ID:moljac,项目名称:MonoMobile.Google.GData,代码行数:15,代码来源:resumableupload.cs


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