public async Task <bool> SendFeedback(string name, string email, string message) { try { HttpWebRequest request = webRequestFactory.CreatePostRequest("https://9332a1f6dcab0d2f3fdafd51eaed07ca.m.pipedream.net"); request.ContentType = "application/x-www-form-urlencoded; charset=UTF-8"; var p = new Dictionary <string, string>(); p.Add("name", name); p.Add("email", email); p.Add("title", "App Feedback"); p.Add("message", message); p.Add("url", ""); var fields = string.Join("&", p.Select(kvp => string.Format("{0}={1}", kvp.Key, HttpUtility.UrlEncode(kvp.Value)))); var version = ApplicationInfo.Version; p = new Dictionary <string, string>() { { "form", fields }, { "other", version } }; await webRequestFactory.PerformPostRequestAsync(request, p); using (var response = await request.GetResponseAsync() as HttpWebResponse) { if (response.StatusCode != HttpStatusCode.OK) { throw new ApplicationException(string.Format("endpoint returned: {0} {1}", response.StatusCode, response.StatusDescription)); } } return(true); } catch (Exception exception) { Logger.Error(exception.ToString()); throw; } }
private async Task Register(string login, string password) { const string url = "https://www.tumblr.com/svc/account/register"; const string referer = "https://www.tumblr.com/login"; var headers = new Dictionary <string, string>(); var request = webRequestFactory.CreatePostXhrRequest(url, referer, headers); cookieService.GetUriCookie(request.CookieContainer, new Uri("https://www.tumblr.com/")); var parameters = new Dictionary <string, string> { { "determine_email", login }, { "user[email]", string.Empty }, { "user[password]", string.Empty }, { "tumblelog[name]", string.Empty }, { "user[age]", string.Empty }, { "context", "no_referer" }, { "version", "STANDARD" }, { "follow", string.Empty }, { "form_key", tumblrKey }, { "seen_suggestion", "0" }, { "used_suggestion", "0" }, { "used_auto_suggestion", "0" }, { "about_tumblr_slide", string.Empty }, { "tracking_url", "/login" }, { "tracking_version", "modal" }, { "random_username_suggestions", "[\"KawaiiBouquetStranger\",\"KeenTravelerFury\",\"RainyMakerTastemaker\",\"SuperbEnthusiastCollective\",\"TeenageYouthFestival\"]" }, { "action", "signup_determine" }, }; await webRequestFactory.PerformPostRequestAsync(request, parameters).ConfigureAwait(false); using (var response = await request.GetResponseAsync().TimeoutAfter(shellService.Settings.TimeOut).ConfigureAwait(false) as HttpWebResponse) { cookieService.SetUriCookie(response.Cookies); } }