Ejemplo n.º 1
0
        /// <summary>
        /// OAuth Get
        /// </summary>
        /// <param name="request">Request details</param>
        /// <returns>Request to be sent to Twitter</returns>
        public WebRequest Get(Request request)
        {
            string outUrl;
            string queryString;

            OAuthTwitter.GetOAuthQueryString(HttpMethod.GET, request, string.Empty, out outUrl, out queryString);

#if SILVERLIGHT
            var fullUrl = ProxyUrl + request.FullUrl;

            var req = WebRequest.Create(fullUrl) as HttpWebRequest;
            req.Headers[HttpRequestHeader.Authorization] = new OAuthTwitter().PrepareAuthHeader(queryString);
            InitializeRequest(req);
#else
            var req = WebRequest.Create(request.FullUrl) as HttpWebRequest;
            if (req != null)
            {
                req.Headers[HttpRequestHeader.Authorization] = new OAuthTwitter().PrepareAuthHeader(queryString, request);

                InitializeRequest(req);
            }
#endif

            return(req);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// OAuth Get
        /// </summary>
        /// <param name="url">Twitter Query</param>
        /// <returns>Request to be sent to Twitter</returns>
        public WebRequest Get(string url)
        {
            string outUrl;
            string queryString;

            OAuthTwitter.GetOAuthQueryString(HttpMethod.GET, url, string.Empty, out outUrl, out queryString);

#if SILVERLIGHT
            var req = HttpWebRequest.Create(
                ProxyUrl + url +
                (string.IsNullOrEmpty(ProxyUrl) ? "?" : "&") +
                queryString);
#else
            var req = HttpWebRequest.Create(outUrl + "?" + queryString) as HttpWebRequest;
            //req.Headers[HttpRequestHeader.Authorization] = PrepareAuthHeader(queryString);

            InitializeRequest(req);
#endif

            return(req);
        }