我在sharepoint onlin上的webclient.openread(url)上收到401未经授权的错误 [英] I am getting 401 unauthorized error on webclient.openread(url) in sharepoint onlin
本文介绍了我在sharepoint onlin上的webclient.openread(url)上收到401未经授权的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
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.
< b>我尝试了什么:
我试过禁用我的代理设置
我已经检查了我的凭据也是/>
它一直工作到现在,突然一个月后它无法正常工作
What I have tried:
I have tried disabling my proxy settings
I have checked my credentials also
It was working till now,all of a sudden after a month it is not working
推荐答案
尝试添加这一行,这可能对你有所帮助< br $>
try adding this line, this might help you
webClient.UseDefaultCredentials = true;
这篇关于我在sharepoint onlin上的webclient.openread(url)上收到401未经授权的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文