Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Setting HTTP Header Authorization for Web Services
protected override WebRequest GetWebRequest(Uri uri)
{
// Assuming authValue is set from somewhere, such as the config file
HttpWebRequest request = (HttpWebRequest)base.GetWebRequest(uri);
request.Headers.Add("Authorization", String.Format("Basic {0}", authValue));
return request;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment