我正在使用以下函数来接收 Artifacory 回购映射:
private string LoadHttpPageWithBasicAuthentication(string url, string username, string password)
{
Uri myUri = new Uri(url);
WebRequest myWebRequest = HttpWebRequest.Create(myUri);
HttpWebRequest myHttpWebRequest = (HttpWebRequest)myWebRequest;
NetworkCredential myNetworkCredential = new NetworkCredential(username, password);
CredentialCache myCredentialCache = new CredentialCache();
myCredentialCache.Add(myUri, "Basic", myNetworkCredential);
myHttpWebRequest.PreAuthenticate = true;
myHttpWebRequest.Credentials = myCredentialCache;
WebResponse myWebResponse = myWebRequest.GetResponse();
Stream responseStream = myWebResponse.GetResponseStream();
StreamReader myStreamReader = new StreamReader(responseStream, Encoding.Default);
string pageContent = myStreamReader.ReadToEnd();
responseStream.Close();
myWebResponse.Close();
return pageContent;
}
我试图传递的 URL 看起来像这样 -
http://ArtifactoryRepo?list&deep=1&listFolders=1&mdTimestamps=1
但从结果来看,请求似乎忽略了部分 URL。收到的结果仅适用于 URL 的那部分 -
我试图将 URL 拆分为两个单独的参数,但它不起作用
有任何想法吗 ?
纳克斯