2.9.04

.NET client vs. Apache web service

Problem: access web service hosted in Apache web server that requires basic authentication?

In derived proxy class override the following:


protected override WebRequest GetWebRequest(Uri uri){
WebRequest req = base.GetWebRequest(uri);
req.Headers.Add("Authorization", "Basic " + Convert.ToBase64String(System.Text.Encoding.ASCII.GetBytes(this.username + ":" + this.password)));

return req;
}

No comments: