private static void AddAuthenticationToRequest(IWebClient webClient, Jira jira) { var credentials = jira.GetCredentials(); if (String.IsNullOrEmpty(credentials.UserName) || String.IsNullOrEmpty(credentials.Password)) { throw new InvalidOperationException("Unable to download attachment, user and/or password are missing. You can specify a provider for credentials when constructing the Jira instance."); } webClient.AddQueryString("os_username", Uri.EscapeDataString(credentials.UserName)); webClient.AddQueryString("os_password", Uri.EscapeDataString(credentials.Password)); }