I am using .net core MVC for a frontend website. I have a module that is getting registered on the front end and backend application that is registering the Module that loads the S3 storage provider, but it is not working and I am not sure why.
Here is a link to a file that I should be seeing in the application. The key exists correctly in my S3 storage as the below:
https://d3rw4xodkp6upl.cloudfront.net/hg/files/kirkseyarchitecture/da/da0580cd-3e54-4baf-a2f7-7a9141870004.jpg
But when trying to access it from the website url, it does not work:
https://kirksey-dev.hexagroup.us/hg/files/kirkseyarchitecture/da/da0580cd-3e54-4baf-a2f7-7a9141870004.jpg
Any clue why this is not working? In the frontend MVC website, do I have to set the appsettings.json or web.config settings like I do in the CMS admin site? The documentation is not clear on this.
Here is my Module code:
using CMS;
using CMS.DataEngine;
using CMS.EventLog;
using CMS.IO;
[assembly: RegisterModule(typeof(KirkseyModule.KirkseyModule))]
namespace KirkseyModule
{
public class KirkseyModule : Module
{
public KirkseyModule() : base("KirkseyModule")
{
}
protected override void OnInit()
{
base.OnInit();
EventLogInfo.Provider.Set(new EventLogInfo
{
EventType = "I",
Source = nameof(KirkseyModule).ToString(),
EventCode = "REGISTRATION",
EventDescription = "Module has been registered."
});
var resourceStringer = new RegisterResourceRegistrar();
resourceStringer.Execute();
// Creates a new StorageProvider instance for Amazon S3
var mediaProvider = StorageProvider.CreateAmazonStorageProvider();
// Specifies the target bucket
mediaProvider.CustomRootPath = "kirksey-website-kentico";
// Makes the bucket publicly accessible
mediaProvider.PublicExternalFolderObject = true;
// Maps a directory to the provider
StorageHelper.MapStoragePath("~/hg/files/", mediaProvider);
StorageHelper.MapStoragePath("~/hg/medialibraries/", mediaProvider);
}
}
}