Пример #1
0
        public virtual OAuthRequestToken GetRequestToken(string callback)
        {
            var args = new FunctionArguments
            {
                ConsumerKey    = _consumerKey,
                ConsumerSecret = _consumerSecret
            };

            var request = _requestTokenQuery.Invoke(args);

            if (!callback.IsNullOrBlank())
            {
                request.AddParameter("oauth_callback", callback);
            }

            var response = _oauth.Request(request);

            SetResponse(response);

            var query = HttpUtility.ParseQueryString(response.Content);
            var oauth = new OAuthRequestToken
            {
                Token                  = query["oauth_token"] ?? "?",
                TokenSecret            = query["oauth_token_secret"] ?? "?",
                OAuthCallbackConfirmed = Convert.ToBoolean(query["oauth_callback_confirmed"] ?? "false")
            };

            return(oauth);
        }
Пример #2
0
        public virtual OAuthAccessToken GetAccessTokenWithXAuth(string username, string password)
        {
            var args = new FunctionArguments
            {
                ConsumerKey    = _consumerKey,
                ConsumerSecret = _consumerSecret,
                Username       = username,
                Password       = password
            };

            var request  = _xAuthQuery.Invoke(args);
            var response = _oauth.Request(request);

            SetResponse(response);

            var query       = HttpUtility.ParseQueryString(response.Content);
            var accessToken = new OAuthAccessToken
            {
                Token       = query["oauth_token"] ?? "?",
                TokenSecret = query["oauth_token_secret"] ?? "?",
                UserId      = Convert.ToInt32(query["user_id"] ?? "0"),
                ScreenName  = query["screen_name"] ?? "?"
            };

            return(accessToken);
        }
Пример #3
0
        /// <summary>
        /// 组装普通文本请求参数。
        /// </summary>
        /// <param name="parameters">Key-Value形式请求参数字典</param>
        /// <returns>URL编码后的请求数据</returns>
        public static string BuildQuery(IDictionary <string, string> parameters)
        {
            StringBuilder postData = new StringBuilder();
            bool          hasParam = false;

            IEnumerator <KeyValuePair <string, string> > dem = parameters.GetEnumerator();

            while (dem.MoveNext())
            {
                string name  = dem.Current.Key;
                string value = dem.Current.Value;
                // 忽略参数名或参数值为空的参数
                if (!string.IsNullOrEmpty(name) && !string.IsNullOrEmpty(value))
                {
                    if (hasParam)
                    {
                        postData.Append("&");
                    }

                    postData.Append(name);
                    postData.Append("=");
                    postData.Append(HttpHelper.UrlEncode(value, Encoding.UTF8));
                    hasParam = true;
                }
            }

            return(postData.ToString());
        }
        private NameValueCollection ParseQueryParameters(Stream stream)
        {
            var rawPostData = new StringBuilder();

            char[] buffer = new char[StreamReaderBufferSize];
            using (StreamReader streamReader = new StreamReader(stream)) {
                int readLength = 0;
                while ((readLength = streamReader.ReadBlock(buffer, 0, StreamReaderBufferSize)) > 0)
                {
                    if (readLength < StreamReaderBufferSize)
                    {
                        char[] bufferLast = buffer.Take(readLength).ToArray();
                        rawPostData.Append(bufferLast);
                        bufferLast = null;
                    }
                    else
                    {
                        rawPostData.Append(buffer);
                    }
                }
            }
            buffer = null;
            NameValueCollection queryParameters = HttpUtility.ParseQueryString(rawPostData.ToString(), Encoding.UTF8);

            rawPostData.Clear();
            return(queryParameters);
        }
Пример #5
0
        public virtual OAuthAccessToken GetAccessToken(OAuthRequestToken requestToken, string verifier)
        {
            var args = new FunctionArguments
            {
                ConsumerKey    = _consumerKey,
                ConsumerSecret = _consumerSecret,
                Token          = requestToken.Token,
                TokenSecret    = requestToken.TokenSecret,
                Verifier       = verifier
            };

            var request  = _accessTokenQuery.Invoke(args);
            var response = _oauth.Request(request);

            SetResponse(response);

            var query       = HttpUtility.ParseQueryString(response.Content);
            var accessToken = new OAuthAccessToken
            {
                Token       = query["oauth_token"] ?? "?",
                TokenSecret = query["oauth_token_secret"] ?? "?",
                UserId      = Convert.ToInt32(query["user_id"] ?? "0"),
                ScreenName  = query["screen_name"] ?? "?"
            };

            return(accessToken);
        }
Пример #6
0
        /// <summary>
        /// Renders a summary about the <see cref="Error"/> object in
        /// body of the HTML document.
        /// </summary>

        protected virtual void RenderSummary()
        {
            HtmlTextWriter writer = this.Writer;
            Error          error  = this.Error;

            //
            // Write the error type and message.
            //

            writer.AddAttribute(HtmlTextWriterAttribute.Id, "errorMessage");
            writer.RenderBeginTag(HtmlTextWriterTag.P);
            HttpUtility.HtmlEncode(error.Type, writer);
            writer.Write(": ");
            HttpUtility.HtmlEncode(error.Message, writer);
            writer.RenderEndTag(); // </p>
            writer.WriteLine();

            //
            // Write out the time, in UTC, at which the error was generated.
            //

            if (error.Time != DateTime.MinValue)
            {
                writer.RenderBeginTag(HtmlTextWriterTag.P);
                writer.Write("Generated: ");
                HttpUtility.HtmlEncode(error.Time.ToUniversalTime().ToString("r"), writer);
                writer.RenderEndTag(); // </p>
                writer.WriteLine();
            }
        }
Пример #7
0
        public static HtmlNode FilePage(SoftFile i)
        {
            HtmlNode node = HtmlNode.CreateNode("<div id=\"filepage\" />");
            var      head = node.AppendChild(HtmlNode.CreateNode("<div id=\"fileheader\" />"));

            head.AppendChild(HtmlNode.CreateNode($"<h1 id=\"filetitle\">{Encode.HtmlEncode(i.Name)}</h1>"));
            if (i.ThumbnailExists)
            {
                head.AppendChild(Thumbnail(i, i.Id.ToString()));
            }
            //node.AppendChild(Thumbnail(i, i.Id.ToString()));
            var tagsandref = node.AppendChild(HtmlNode.CreateNode("<div id=\"tagsandref\" />"));
            var refrr      = i.References;

            if (refrr.Count > 0)
            {
                tagsandref.AppendChild(List("div", "References", "filereferencelist", refrr.Select(n => $"<a id=\"filereferences\" href=\"/file&{n.Id}\">{Encode.HtmlEncode(n.Name)}</a>").ToArray()));
            }
            node.AppendChild(HtmlNode.CreateNode($"<p id=\"hashes\">{i.Hashes}</p>"));
            var tags = i.Tags;

            if (tags.Count > 0)
            {
                tagsandref.AppendChild(List("div", "Tags", "taglist", tags.Select(n => $"<p id=\"tag\">{n}</p>").ToArray()));
            }
            return(node);
        }
Пример #8
0
        /// <summary>
        /// ######### ######### ############ ########, ######### #######
        /// </summary>
        /// <param name="rcptMergeVar">###### ######### ############ ########</param>
        /// <param name="bulkEmailRId">######## ############# ###### email ########</param>
        /// <param name="bulkEmailId">############# ###### email ########</param>
        /// <param name="emailAddress">Email ##### ##########</param>
        public void InitPersonalUnsubscribeMacros(rcpt_merge_var rcptMergeVar, int bulkEmailRId,
                                                  Guid bulkEmailId, string emailAddress)
        {
            if (_isUsubscribeFromAllMailings)
            {
                return;
            }
            string bulkEmail = String.Format("{0:0000000000}", bulkEmailRId);

            foreach (string alias in UnsubscribeMacrosAliases)
            {
                rcptMergeVar.rcpt = emailAddress;
                string unsubscribeHash = MandrillUtilities.StringCrypto.EncryptString(emailAddress,
                                                                                      bulkEmailId.ToString("N"));
                string unsubscribeKey = string.Concat(bulkEmail, unsubscribeHash);
                unsubscribeKey = HttpUtility.UrlEncode(unsubscribeKey);
                string unsubscribeLinkParameter = string.Format(UnsubscribeLinkParameterPattern, unsubscribeKey);
                string unsubscribeLink          = !string.IsNullOrEmpty(_unsubscribeApplicationUrl)
                                                ? string.Concat(_unsubscribeApplicationUrl, unsubscribeLinkParameter)
                                                : string.Concat(string.Format(UnsubscribeLinkPattern, _applicationUrl),
                                                                unsubscribeLinkParameter);
                var mergeVar = new merge_var()
                {
                    name = alias, content = unsubscribeLink
                };
                rcptMergeVar.vars.Add(mergeVar);
            }
        }
Пример #9
0
        /// <summary>
        /// This methid decodes a UTF8 encoded path
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static string PathDecodeUTF8(string text)
        {
            var output = string.Empty;

            if (text.StartsWith("/"))
            {
                output = "/";
            }

            var elements = text.Split('/');

            foreach (var s in elements)
            {
                if (s == string.Empty)
                {
                    continue;
                }

                if (!output.EndsWith("/"))
                {
                    output += "/";
                }

                // do the normal stuff
                output += HttpUtility.UrlDecode(s);
            }

            if (text.EndsWith("/"))
            {
                output += "/";
            }

            return(output);
        }
        private static string RemoveExtraParametersFromUri(string hyperLink)
        {
            var preparedUrl = HttpUtility.UrlDecode(hyperLink);

            preparedUrl = BulkEmailUtmHelper.RemoveUtmFromUri(preparedUrl);
            return(BulkEmailHyperlinkHelper.RemoveExtraParametersFromUri(preparedUrl));
        }
Пример #11
0
        /// <summary>
        /// Similar to Get User but with authenticated user (token owner) as user id.
        /// <code>scope = identify</code>
        /// </summary>
        /// <param name="user">Id of the user.</param>
        /// <param name="gameMode"><see cref="GameMode"/>. User default mode will be used if not specified.</param>
        /// <returns></returns>
        public User GetUser(string user, GameMode?gameMode = null)
        {
            string route = $"/users/{HttpUtility.UrlEncode(user)}/{gameMode?.ToParamString()}";
            var    json  = _httpClient.HttpGet(OsuClientV2.BaseUri + route);

            var obj = JsonConvert.DeserializeObject <User>(json);

            return(obj);
        }
Пример #12
0
        public Beatmapset[] GetUserBeatmap(string user, UserBeatmapType type)
        {
            string route = $"/users/{HttpUtility.UrlEncode(user)}/beatmapsets/{type.ToParamString()}?limit=500&offset=0";
            var    json  = _httpClient.HttpGet(OsuClientV2.BaseUri + route);

            var obj = JsonConvert.DeserializeObject <Beatmapset[]>(json);

            return(obj);
        }
Пример #13
0
        public ActionResult googleContacts()
        {
            var continueUrl = string.Concat(GeneralConstants.HTTP_HOST, "/callback?sd=", accountHostname, "&path=",
                                            HttpUtility.UrlEncode("/dashboard/contacts/import"),
                                            "&type=", ContactImportType.GOOGLE);
            var authsubUrl = AuthSubUtil.getRequestUrl(continueUrl, GoogleConstants.FEED_CONTACTS, false, false);

            return(Redirect(authsubUrl));
        }
Пример #14
0
 private string GetMessage(Entity entity, UserConnection userConnection)
 {
     if (entity.GetTypedColumnValue <bool>("IsHtmlBody"))
     {
         return(userConnection.GetIsFeatureEnabled("DisableEmailDecoding")
                                 ? entity.GetTypedColumnValue <string>("Body")
                                 : HttpUtility.HtmlDecode(entity.GetTypedColumnValue <string>("Body")));
     }
     return(StringUtilities.FormatForHtml(entity.GetTypedColumnValue <string>("Body")));
 }
        private string GetMacrosValue(string macrosName, string macrosContent)
        {
            string resultContent = macrosContent;

            if (UrlEncodedMacrosAliasRegex.IsMatch(macrosName))
            {
                resultContent = HttpUtility.UrlPathEncode(macrosContent);
            }
            return(resultContent);
        }
Пример #16
0
        public static HtmlNode IndexPage(CentralIndex i)
        {
            HtmlNode node = HtmlNode.CreateNode("<div id=\"indexpage\" />");

            node.AppendChild(HtmlNode.CreateNode($"<h1 id=\"indextitle\">{Encode.HtmlEncode("Index of /")}</h1>"));
            foreach (var a in i.Files)
            {
                node.AppendChild(FileStrip(a));
            }
            return(node);
        }
Пример #17
0
        public static HtmlNode IndexPage(SoftDirectory i)
        {
            HtmlNode node = HtmlNode.CreateNode("<div id=\"indexpage\" />");

            node.AppendChild(HtmlNode.CreateNode($"<h1 id=\"indextitle\">{Encode.HtmlEncode($"Index of {i}")}</h1>"));
            foreach (var a in i.SoftFiles)
            {
                node.AppendChild(FileStrip(a));
            }
            return(node);
        }
Пример #18
0
        public void UrlEncodeForForm_1()
        {
            Console.WriteLine(SymbolChars);

            // space and "#$%&'+,/:;<=>?@[\]^`{|}~
            UrlEncodeTest(NetWebUtility.UrlEncode);
            // space and "#$%&'+,/:;<=>?@[\]^`{|}~
            UrlEncodeTest(s => WebHttpUtility.UrlEncode(s).ToUpperInvariant());
            // space and !"#$%&'()*+,/:;<=>?@[\]^`{|}
            UrlEncodeTest(UriHelper.UrlEncodeForForm);
        }
Пример #19
0
        private static string BuildUriString(Uri uri, NameValueCollection queryParameters)
        {
            string processedQuery = QueryParametersToQueryString(uri, queryParameters);
            string originalQuery  = HttpUtility.UrlDecode(uri.Query + uri.Fragment);
            string originalUri    = HttpUtility.UrlDecode(uri.OriginalString);

            if (!string.IsNullOrEmpty(originalQuery))
            {
                originalUri = originalUri.Replace(originalQuery, string.Empty);
            }
            return(originalUri + Uri.UnescapeDataString(processedQuery));
        }
Пример #20
0
        private void update_website(FinalPackageTestResultMessage message)
        {
            SecurityProtocol.set_protocol();
            this.Log().Info(() => "Updating website for {0} v{1} with success '{2}' and results url: '{3}'".format_with(message.PackageId, message.PackageVersion, message.Success, message.ResultDetailsUrl));

            try
            {
                var resultsUri = new Uri(message.ResultDetailsUrl);
            }
            catch (Exception ex)
            {
                Bootstrap.handle_exception(ex);
                return;
            }

            try
            {
                var        url    = string.Join("/", SERVICE_ENDPOINT, message.PackageId, message.PackageVersion);
                HttpClient client = _nugetService.get_client(_configurationSettings.PackagesUrl, url, "POST", "application/x-www-form-urlencoded");

                StringBuilder postData = new StringBuilder();
                postData.Append("apikey=" + HttpUtility.UrlEncode(_configurationSettings.PackagesApiKey));
                postData.Append("&success=" + HttpUtility.UrlEncode(message.Success.to_string().to_lower()));
                postData.Append("&resultDetailsUrl=" + HttpUtility.UrlEncode(message.ResultDetailsUrl));
                var form = postData.ToString();
                var data = Encoding.ASCII.GetBytes(form);

                client.SendingRequest += (sender, e) =>
                {
                    SendingRequest(this, e);
                    var request = (HttpWebRequest)e.Request;
                    request.Timeout = 30000;
                    request.Headers.Add(_nugetService.ApiKeyHeader, _configurationSettings.PackagesApiKey);

                    request.ContentLength = data.Length;

                    using (var stream = request.GetRequestStream())
                    {
                        stream.Write(data, 0, data.Length);
                    }
                };

                _nugetService.ensure_successful_response(client);
            }
            catch (Exception ex)
            {
                Bootstrap.handle_exception(ex);
            }

            this.Log().Info("Finished verification for {0} v{1}.".format_with(message.PackageId, message.PackageVersion));
            // EventManager.publish(new WebsiteUpdateMessage());
        }
Пример #21
0
        public ActionResult blogger()
        {
            var viewdata = new NetworkViewModel();

            viewdata.bloggerSessionKey = MASTERdomain.bloggerSessionKey;
            viewdata.blogList          = MASTERdomain.googleBlogs.ToModel();

            var continueUrl = string.Concat(GeneralConstants.HTTP_HOST, "/callback?sd=", accountHostname, "&path=",
                                            HttpUtility.UrlEncode("/dashboard/blogger/saveToken"));

            viewdata.requestUrl = AuthSubUtil.getRequestUrl(continueUrl, GoogleConstants.FEED_BLOGGER, false, true);
            return(View(viewdata));
        }
        /// <summary>获取App信息</summary>
        public static async Task <AppInfo?> GetAppInfo(this IAppClusterClient client, CancellationToken cancellationToken = default)
        {
            if (client == null)
            {
                throw new ArgumentNullException(nameof(client));
            }
#if NET40
            var list = await client.Get <IList <AppInfo> >("apps?appIds=" + WebUtility.UrlEncode(client.AppId), cancellationToken).ConfigureAwait(false);
#else
            var list = await client.Get <IReadOnlyList <AppInfo> >("apps?appIds=" + WebUtility.UrlEncode(client.AppId), cancellationToken).ConfigureAwait(false);
#endif
            return(list?.FirstOrDefault());
        }
Пример #23
0
        /// <summary>
        /// Renders the contents of the control into the specified writer.
        /// </summary>

        protected override void RenderContents(HtmlTextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            //
            // Write out the assembly title, version number, copyright and
            // license.
            //

            AboutSet about = this.About;

            writer.Write("Powered by ");
            writer.AddAttribute(HtmlTextWriterAttribute.Href, "http://elmah.googlecode.com/");
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            HttpUtility.HtmlEncode(Mask.EmptyString(about.Product, "(product)"), writer);
            writer.RenderEndTag();
            writer.Write(", version ");

            string version = about.GetFileVersionString();

            if (version.Length == 0)
            {
                version = about.GetVersionString();
            }

            HttpUtility.HtmlEncode(Mask.EmptyString(version, "?.?.?.?"), writer);

#if DEBUG
            writer.Write(" (" + Build.Configuration + ")");
#endif

            writer.Write(". ");

            string copyright = about.Copyright;

            if (copyright.Length > 0)
            {
                HttpUtility.HtmlEncode(copyright, writer);
                writer.Write(' ');
            }

            writer.Write("Licensed under ");
            writer.AddAttribute(HtmlTextWriterAttribute.Href, "http://www.apache.org/licenses/LICENSE-2.0");
            writer.RenderBeginTag(HtmlTextWriterTag.A);
            writer.Write("Apache License, Version 2.0");
            writer.RenderEndTag();
            writer.Write(". ");
        }
Пример #24
0
        /// <summary>
        /// This method encodes an url
        /// </summary>
        /// <param name="text"></param>
        /// <returns></returns>
        public static string UrlEncodeUTF8(string text)
        {
            if (text == null)
            {
                return(null);
            }

            if (text.Length == 0)
            {
                return("");
            }

            // encode with url encoder
            var enc = HttpUtility.UrlEncode(text, Encoding.UTF8);

            // fix the missing space
            enc = enc.Replace("+", "%20");

            // fix the exclamation point
            enc = enc.Replace("!", "%21");

            // fix the quote
            enc = enc.Replace("'", "%27");

            // fix the parentheses
            enc = enc.Replace("(", "%28");
            enc = enc.Replace(")", "%29");

            enc = enc.Replace("%2f", "/");

            // uppercase the encoded stuff
            var enc2 = new StringBuilder();

            for (var i = 0; i < enc.Length; i++)
            {
                // copy char
                enc2.Append(enc[i]);

                // upper stuff
                if (enc[i] == '%')
                {
                    enc2.Append(char.ToUpper(enc[i + 1]));
                    enc2.Append(char.ToUpper(enc[i + 2]));

                    i += 2;
                }
            }

            return(enc2.ToString());
        }
Пример #25
0
        public static Uri AddQueryParamsToUri(Uri uri, IEnumerable <KeyValuePair <string, string> > newQuery)
        {
            var query = HttpUtility.ParseQueryString(uri.Query);

            foreach (var entry in newQuery)
            {
                query[entry.Key] = entry.Value;
            }

            var builder = new UriBuilder(uri);

            builder.Query = query.ToString();

            return(builder.Uri);
        }
Пример #26
0
        /// <summary>
        /// Renders the details about the <see cref="Error" /> object in
        /// body of the HTML document.
        /// </summary>

        protected virtual void RenderDetail()
        {
            HtmlTextWriter writer = this.Writer;

            //
            // Write the full text of the error.
            //

            writer.AddAttribute(HtmlTextWriterAttribute.Id, "errorDetail");
            writer.RenderBeginTag(HtmlTextWriterTag.Pre);
            writer.InnerWriter.Flush();
            HttpUtility.HtmlEncode(this.Error.Detail, writer.InnerWriter);
            writer.RenderEndTag(); // </pre>
            writer.WriteLine();
        }
Пример #27
0
        Uri QualifyUri(string path, QueryString queryString = null)
        {
            if (queryString != null && queryString.Count > 0)
            {
                Uri uri = linkResolver.Resolve(path);

                NameValueCollection currentQueryStrings = HttpUtility.ParseQueryString(uri.Query);
                foreach (var pair in queryString)
                {
                    currentQueryStrings.Set(pair.Key, pair.Value.ToString());
                }
                path = string.Concat(uri.AbsolutePath, "?", currentQueryStrings);
            }

            return(linkResolver.Resolve(path));
        }
        /// <summary>
        /// ############## ##### ######### ###### <see cref="LeadSourceHelper"/>.
        /// </summary>
        /// <param name="userConnection">######### ################# ###########.</param>
        /// <param name="bpmHref">URL ########.</param>
        /// <param name="bpmRef">URL #########.</param>
        public LeadSourceHelper(UserConnection userConnection, string bpmHref, string bpmRef)
        {
            this.userConnection = userConnection;
            this.bpmHref        = bpmHref;
            this.bpmRef         = bpmRef;
            Uri uri;

            if (Uri.TryCreate(this.bpmHref, UriKind.Absolute, out uri))
            {
                bpmHrefParameters = HttpUtility.ParseQueryString(uri.Query);
            }
            else
            {
                bpmHrefParameters = HttpUtility.ParseQueryString(string.Empty);
            }
        }
Пример #29
0
        public static void SaveBulkEmailHyperlinks(Guid bulkEmailId, string templateBody, bool replace,
                                                   UserConnection userConnection)
        {
            if (replace)
            {
                ClearBulkEmailHyperlinks(bulkEmailId, userConnection);
            }
            if (string.IsNullOrEmpty(templateBody))
            {
                return;
            }

            IDictionary <string, string> hyperlinks = MailingUtilities.ParseHtmlHyperlinks(templateBody);

            foreach (KeyValuePair <string, string> hyperlink in hyperlinks)
            {
                try {
                    if (HasMacros(hyperlink.Key))
                    {
                        continue;
                    }
                    string decodeUrl = HttpUtility.UrlDecode(hyperlink.Key);
                    string url       = UtmHelper.RemoveUtmFromUri(decodeUrl);
                    string caption   = string.IsNullOrEmpty(hyperlink.Value) ? url : hyperlink.Value;
                    decodeUrl = HttpUtility.UrlDecode(url.ToLower());
                    Guid hashLink           = MailingUtilities.GetMD5HashGuid(decodeUrl);
                    var  bulkEmailHyperlink = new BulkEmailHyperlink(userConnection);
                    Dictionary <string, object> conditions = new Dictionary <string, object> {
                        { "BulkEmail", bulkEmailId },
                        { "Hash", hashLink }
                    };
                    if (!bulkEmailHyperlink.FetchFromDB(conditions))
                    {
                        bulkEmailHyperlink.SetDefColumnValues();
                        bulkEmailHyperlink.BulkEmailId = bulkEmailId;
                        bulkEmailHyperlink.Caption     = caption;
                        bulkEmailHyperlink.Url         = url;
                        bulkEmailHyperlink.Hash        = hashLink;
                        bulkEmailHyperlink.Save();
                    }
                } catch (Exception e) {
                    MailingUtilities.Log.ErrorFormat(
                        "[BulkEmailHyperlinkHelper.SaveBulkEmailHyperlinks]: Error while saving BulkEmailHyperlink" +
                        " \"{0}\" for BulkEmail with Id: {1}", e, hyperlink, bulkEmailId);
                }
            }
        }
Пример #30
0
        public bool GetAccessToken()
        {
            BuildRequestUrl();
            string      content;
            WebResponse response;

            try
            {
                var request = WebRequest.Create(requestUrl);
                response = request.GetResponse();
                using (var sr = new StreamReader(response.GetResponseStream()))
                {
                    content = sr.ReadToEnd();
                }
            }
            catch (WebException ex)
            {
                response = ex.Response;
                if (response != null)
                {
                    using (var sr = new StreamReader(response.GetResponseStream()))
                    {
                        var error = sr.ReadToEnd();
                        Syslog.Write("oauthrequest Error: " + requestUrl + " " + error);
                    }
                }
                return(false);
            }

            parameters = HttpUtility.ParseQueryString(content);

            oauth_token  = parameters["oauth_token"];
            oauth_secret = parameters["oauth_token_secret"];
            switch (type)
            {
            case OAuthTokenType.YAHOO:
                guid = parameters["xoauth_yahoo_guid"];
                break;

            default:
                break;
            }

            return(true);
        }