Contributor
7224 Points
Re: Howto pass Authorisation token in GET/POST REQUEST Header to webservice
Jan 06, 2012 08:04 AM|LINK
Hi costrak,
you can pass them with HttpWebRequest.Credentials Property
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("url"); request.Credentials = new NetworkCredential("username", "password");
also take a look at HttpWebRequest.PreAuthenticate Property.
To force/manualy add the authentication
string credidentials = userName + ":" + Password; authorization = Convert.ToBase64String(Encoding.Default.GetBytes(credidentials)); req.Headers["Authorization"] = "Basic " + authorization;