如果我有一个随机的URL,我该如何检查它是否指向Azure中的Blob?如果它指向Azure Blob,我可以确定这个Blob存在并且我可以访问它。
我尝试了以下方法:
I made some tests with Exists, but it's not very satisfying:
new CloudBlockBlob(new Uri("http://example.com")) ArgumentException: Invalid blob address 'http://example.com/', missing container information new CloudBlockBlob(new Uri("https://example.com/fdh/3746C9A2-533E-4544-A10B-321A8BC40AEA/sample-file.txt")).Exists() false new CloudBlockBlob(new Uri("http://stackoverflow.com/questions/43109843/ways-to-migrate-documents-pdf-forms-from-ms-sharepoint-to-aem")).Exists() StorageException: Blob type of the blob reference doesn't match blob type of the blob.
So basically creating the
CloudBlockBlob
can fail,Exists
can fail or returnfalse
.But it just feels wrong to do it like this.
I could check the url to be
https://<storage-account>.blob.core.windows.net/<container>/*
, but I'm not sure if this is always correct.
是否有其他(更好的)方法来检查随机URL是否指向Azure中的Blob(也许是(Azure Storage SDK)盒子之外的东西)?