本文介绍了我在sharepoint onlin上的webclient.openread(url)上收到401未经授权的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞!Hi,I am getting 401 unauhtorized issue,when I try to execute this "Stream stream = webClient.OpenRead(imageInformation.Url)" line;I am giving the full piece of code for your reference.using (WebClient webClient = new WebClient()) { webClient.Credentials = new SharePointOnlineCredentials(ConfigSettings.VNextSiteUsername, password); webClient.Headers.Add(CommonConstants.Authentication, "f"); if (imageInformation.Url != null) { Stream stream = webClient.OpenRead(imageInformation.Url); Bitmap bitmap = new Bitmap(stream); stream.Flush(); stream.Close(); Directory.CreateDirectory(ConfigSettings.DownloadPath); bitmap.Save(ConfigSettings.DownloadPath + imageInformation.GPNNumber + '.' + imageInformation.Extension); Console.WriteLine("Profile pictures downloaded to local - " + imageInformation.GPNNumber + '.' + imageInformation.Extension); } }Please help me. 我尝试了什么: 我试过禁用我的代理设置 我已经检查了我的凭据也是/> 它一直工作到现在,突然一个月后它无法正常工作What I have tried:I have tried disabling my proxy settingsI have checked my credentials alsoIt was working till now,all of a sudden after a month it is not working推荐答案尝试添加这一行,这可能对你有所帮助try adding this line, this might help youwebClient.UseDefaultCredentials = true; 这篇关于我在sharepoint onlin上的webclient.openread(url)上收到401未经授权的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-20 12:03