Media Library Items saving to ~/admin/SiteName/Media instead of ~/SiteName/Media

Michael Legacy asked on May 6, 2019 18:52

Hey there, I'm having an issue where Kentico media libraries are saving in my Kentico solution, instead of in my MVC one. This is causing issues with my Azure storage blob, since the module is looking to the MVC project media folders.

This was not an issues before. It randomly started happening. We have a few devs working on the project and no one changed anything they believe could be causing the issue.

I checked Settings -> Media -> Media Library Folders and it's the default value. As well as Settings -> System -> Files.

Not sure why it started saving files there now, but it's kind of throwing me for a loop. Here is my initialization code. I have confirmed that it is initializing the assembly in the App_Start sequence.

public class AzureStorageInitializationModule : Module
    // Register the module under the name "AzureStorageInitialization"
    public AzureStorageInitializationModule()
        : base("AzureStorageInitialization")

    // Contains initialization code that is executed when the application starts
    protected override void OnInit()

        // Creates a new StorageProvider instance for Azure
        var mediaProvider = StorageProvider.CreateAzureStorageProvider();

        //Specifies the target container name in Azure Storage
        mediaProvider.CustomRootPath = "cms";

        // Makes the container publicly accessible
        mediaProvider.PublicExternalFolderObject = true;

        // Maps a directory to the provider
        // A path of "~/" is fine, it will generate based on your site code name, ex: "~/<site-codename>/media"
        // Full path of this code CustomRootPath and MapStoragePath == "~/cms/dancinggoatmvc/media/"
        StorageHelper.MapStoragePath("~/Carle/Media", mediaProvider);
        StorageHelper.MapStoragePath("~/Carle/Files", mediaProvider);


And my Web.Config settings:

<add key="CMSAzureAccountName" value="ACCOUNTNAMEHERE" />
<add key="CMSAzureSharedKey" value="SECRETKEY" />
<add key="CMSAzureBlobEndpoint" value="https://<name>" />
<add key="CMSAzurePublicContainer" value="true" />
<add key="CMSAzureCDNEndpoint" value="https://<name>" />    

Recent Answers

Michael Legacy answered on May 6, 2019 20:19

Also, my files are saving to the Azure blob storage location, as well as locally, but the Direct URL is still "/admin/site-name/media...", and is not changing to my CDN endpoint anymore. No changes were made to the web.config and I have the proper CMSAzurePublicContainer and CMSAzureCDNEndpoint keys setup.

This is all really weird.

0 votesVote for this answer Mark as a Correct answer

Dmitry Bastron answered on May 7, 2019 12:39

Hi Michael,

Have you checked "Use permanent URLs" setting? Maybe someone of your team unticked it? If so, please try to tick it back and restart the website.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.