Unable to get relative path for azure storage media in kenitco 12 sp (MVC)

Nikhila Reddy Pocha asked on August 29, 2019 20:56

Hello everyone,

I recently migrated the source of media library in kentico 12 sp development model MVC from local file system to azure storage reference,but after migrating the media from local file system to azure the media library path has changed due which I m struggling with broken path issues through out the site, please help me out how to get the existing path working with azure storage.

OLD PATH: http://samplesites.azurewebsites.net/mywebsite/media/portalmedia/test.pdf

NEW PATH(Direct PATH): https://samplesites.blob.core.windows.net/mywebsite/cms/media/portalmedia/test.pdf

NEW PATH(Permanent PATH): https://samplesites.admin.azuresites.net/mywebsite/getmedia/16b40b07-9b41-4812-9194-4bb35470ad8c/test.pdf

I need a relative URL like this /mywebsite/media/portalmedia/test.pdf so my existing mapped path not broke.

Awaiting for recommendation/suggestion to overcome this issue.



Recent Answers

Mike Wills answered on August 29, 2019 22:40

Hi Nikhila,

This is a tough issue, but there's a few approaches:

  • Create a tool that scans all your documents/pages, looks for media URLs and updates them to the new format

  • Create an MVC Action Filter to scan the HTML output for media URLs and dynamically update them.

  • Keep the existing media library using local storage so that the URLs are not changed, but then create a new media library, and map that one to Azure storage. This will allow using Azure Storage for new media, without having to update all the URLs pointing to existing media.


1 votesVote for this answer Mark as a Correct answer

Peter Mogilnitski answered on August 30, 2019 15:35

You may consider as well using URL Rewrite module.

0 votesVote for this answer Mark as a Correct answer

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