当我尝试使用临时共享访问签名 (SAS) 创建/访问 Azure blob 时,我收到“远程服务器返回错误:(403) 禁止”。错误。有人可以帮我确定这段代码出了什么问题吗?
// Calling this function from Main().
public void uploadToBlob()
{
string content = "Hello World - Content of the file";
string fileName = "TestFile";
UploadFileToAzureBlobStorage(content, fileName);
}
void UploadFileToAzureBlobStorage(string content, string fileName)
{
string storageKey = "SAS Key";
string storageAccount = "Storage Account name";
string containerName = "Container Name";
string blobName = fileName;
string method = "PUT";
string sampleContent = content;
int contentLength = Encoding.UTF8.GetByteCount(sampleContent);
string requestUri = $"https://{storageAccount}.blob.core.windows.net/{containerName}/{blobName}";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(requestUri); …Run Code Online (Sandbox Code Playgroud) 我正在开发一个C#控制台应用程序,它工作正常,直到昨天.当我尝试运行相同的控制台应用程序时,它不允许我进行调试,将错误称为"应用程序处于中断模式.您的应用程序已进入中断状态,但当前没有代码正在执行所选调试引擎(例如,只执行本机运行时代码)."
有没有人遇到类似的问题,并提前解决了.
我正在尝试使用控制台可执行文件中的上下文令牌连接SharePoint 2013 Online网站.但是,它给了我错误The remote server returned an error: (403) Forbidden.
这是代码片段:
string spurl = ConfigurationManager.AppSettings["Sharepoint_URL"].ToString();
using (ClientContext context = new ClientContext(spurl))
{
context.Credentials = new NetworkCredential("username", "password", "domain");
context.ExecuteQuery();
Web web = context.Web;
context.Load(web);
context.ExecuteQuery();
Console.WriteLine(context.Web.Title);
}
Console.ReadKey();
Run Code Online (Sandbox Code Playgroud)
如何与SharePoint Online建立连接?它是否仅支持基于声明的身份验证?