public static async Task <bool> CheckExistenceAsync(string encryptedString) { bool exists = false; string boomserverExists = (boomServer + "/users/exists?s="); Url existsUrl = new Url(boomserverExists + encryptedString); //------------------------------------------------------- //HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(existsUrl.ToString()); //request.Method = "GET"; //using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) //{ //} try { HttpResponseMessage response = await existsUrl.AllowHttpStatus("404").SendAsync(HttpMethod.Get, null); exists = (response.StatusCode == System.Net.HttpStatusCode.NoContent); } catch (Exception exception) { try { TraceHelper.TraceException("D7B1FC61_D70A_4A08_9235_0236C3904065", exception); } catch (Exception) { } } return(exists); }
public static IFlurlRequest AllowNonOkCodes(this Url url) { return(url.AllowHttpStatus(HttpStatusCode.NotFound) .AllowHttpStatus(HttpStatusCode.Conflict)); }