title: Getting Access Denied Exception when deleting a file in Amazon S3 using the .Net AWSSDK
body: <p>I am trying to do some simple file IO using amazon S3 and C#.</p>
  
  <p>So far I have been able to create files and list them. I am the bucket owner and I should have full access. In CloudBerry I can create and delete files in the bucket. In my code when I try to delete a file I get an access denied exception.</p>
  
  <p>This is my test method:</p>
  
  <pre><code>[Test]
  public void TestThatFilesCanBeCreatedAndDeleted()
  {
      const string testFile = "test.txt";
  
      var awsS3Helper = new AwsS3Helper();
  
      awsS3Helper.AddFileToBucketRoot(testFile);
      var testList = awsS3Helper.ListItemsInBucketRoot();
      Assert.True(testList.ContainsKey(testFile)); // This test passes
      awsS3Helper.DeleteFileFromBucket(testFile); // Access denied exception here
      testList = awsS3Helper.ListItemsInBucketRoot();
      Assert.False(testList.ContainsKey(testFile)); 
  
  }
  </code></pre>
  
  <p>My method to add a file:</p>
  
  <pre><code>var request = new PutObjectRequest();
          request.WithBucketName(bucketName);
          request.WithKey(fileName);
          request.WithContentBody("");
          S3Response response = client.PutObject(request);
          response.Dispose();
  </code></pre>
  
  <p>My method to delete a file:</p>
  
  <pre><code>var request = new DeleteObjectRequest()
          {
              BucketName = bucketName,
              Key = fileKey
          };
          S3Response response = client.DeleteObject(request);
          response.Dispose();
  </code></pre>
  
  <p>After running the code the file is visible in CloudBerry and I can delete it from there.</p>
  
  <p>I have very little experience with Amazon S3 so I don't know what could be going wrong. Should I be putting some kind of permissions on to any files I create or upload? Why would I be able to delete a file while I am logged in to CloudBerry with the same credentials provided to my program?</p>