Karthikeyan Sekar
Karthikeyan Sekar

Reputation: 333

When Delete the blob in azure cloud The remote server returned an error: (404) Not Found

The remote server returned an error: (404) Not Found ..How to Solve this Problem...

    public object Delete(string name)
    {
        dynamic deleted = true;

        try
        {
            CloudBlobClient blobClient = SMBS.GetBlobContainer();
            CloudBlobContainer blobContainer = blobClient.GetContainerReference("container1");

            CloudBlockBlob blockBlob = blobContainer.GetBlockBlobReference(name);
            blockBlob.Delete();
        }
        catch (Exception ex)
        {
            deleted = false;
        }

        return deleted;
    }

Upvotes: 0

Views: 1579

Answers (1)

Serdar Ozler
Serdar Ozler

Reputation: 3802

The blob could be actually missing or your request might not be authenticated. Please see if the credentials are correct. In addition, there is already a ICloudBlob.DeleteIfExists method in Azure Storage Client Library that you can use instead of your Delete method.

Upvotes: 4

Related Questions