get downloaded string

Eduardo Gomez 4,156 Reputation points
2022-03-06T16:36:43.41+00:00

Hello

I have this code to upload, and get the URL, but I cannot get URL

 private async void SaveAction() {  
  
            //Upload to Azure, with a unique name, and get the location  
  
            var LocalFolder = FileSystem.AppDataDirectory;  
  
            var FilePath = Path.Combine(LocalFolder, $"{Note.Name}.rtf");  
  
            var FileName = Path.GetFileName(FilePath);  
  
            using (StreamWriter sw = new StreamWriter(FilePath)) {  
  
                sw.WriteLine(HtmlText);  
            }  
  
           var Location = await App.AzureService.UploadToAzureBlobStorage(FilePath, FileName);  
            System.Console.WriteLine(Location);  
  
            File.Delete(FilePath);  

Azure Servce

   public async Task<string> UploadToAzureBlobStorage(string filePath, string fileName) {  
  
            var conectionString = AppConstant.ConectionString;  
            var containerName = AppConstant.ContanerName;  
  
            var AzureStorage = new BlobContainerClient(conectionString, containerName);  
  
            var blob = AzureStorage.GetBlobClient(fileName);  
            await blob.UploadAsync(filePath, true);  
  
            return $"https://notesbucket.blob.core.windows.net/notes/{fileName}";  
  
        }  

But I get this

https://notesbucket.blob.core.windows.net/notes/Shopping list.rtf  

<Error>  
<Code>BlobNotFound</Code>  
<Message>The specified blob does not exist. RequestId:162ae91a-801e-0042-2978-31fcf1000000 Time:2022-03-06T16:34:41.3417951Z</Message>  
</Error>  
  

My url: https://notesbucket.blob.core.windows.net/notes/Shopping list.rtf

FileName: Shopping list.rtf

180398-screenshot-2022-03-06-192354.png

Developer technologies | .NET | Xamarin
Azure Blob Storage
Azure Blob Storage
An Azure service that stores unstructured data in the cloud as blobs.
{count} votes

Answer accepted by question author
  1. Anonymous
    2022-03-07T05:11:14.733+00:00

    Hello,​

    Please check the access of container. please set it to public. Go and Edit container meta data on azure blob storage. when you create blob within Storage Account where public access is allowed, the default is to create them as private.

    Best Regards,

    Leon Lu


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.