public static string username = "xxx"; public static string password = "xxx"; public static string uri = "https://1.1.1.1/x/x";< webrequest req = webrequest.create(uri); req.method = "GET"; httpwebresponse res = null; res = (httpwebresponse)req.getresponse(); string resu = null; using (stream stm = res.getresponsestream()) { streamreader sr = new streamreader(stm); resu = sr.readtoend(); sr.close(); } }
var encoding = System.Text.Encoding.GetEncoding("ISO-8859-1"); byte[] headerBytes = encoding.GetBytes(username + ":" + password); string headerValue = Convert.ToBase64String(headerBytes); req.Headers.Add("Authorization", "Basic " + encoded);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)