当我尝试从本地 SharePoint 网站获取图像时收到 401 消息。尝试了许多凭据设置,但它们都返回相同的 401 错误。
var SharePointURL = "http://SharePointServer/Site/ImageFolder/image1.jpg";
System.Net.WebRequest req = System.Net.WebRequest.Create(SharePointURL);
req.Credentials = System.Net.CredentialCache.DefaultCredentials;
req.UseDefaultCredentials = true;
System.Net.WebResponse response = req.GetResponse();
Stream stream = response.GetResponseStream();
System.Drawing.Image img = System.Drawing.Image.FromStream(stream);
stream.Close();
任何帮助,将不胜感激。