K13 azure storage 'permanent link' 404

Aaron Macdonald asked on November 15, 2022 08:25

Hello

We have an azure storage account configured for media in K13 and get a 404 when trying to access any images via a 'permanent link', however the 'direct path' works correctly.

Just to clarify the meaning here:

  • Direct path is via the admin site e.g. /CMSPages/GetAzureFile.aspx?path=~%5Cmysite%5Cmedia%5Cimagery%5Cctas%5Calert.png&hash=ab468705a5dcbaf16c7bc18ae7ee3511e278c2521ed5cea62a5f13c82d18fb6a
  • Permanent link is via mvc with a guid e.g. /getmedia/f69c72a5-164e-4577-ab8d-34bbca68eec1/Alert.png

Can anyone please advise why this might be the case?

Platform

  • K13 v13.0.73
  • .NET Framework
  • CTB Routing

Correct Answer

Aaron Macdonald answered on November 16, 2022 02:53

Thanks Juraj. We had deployed the storage module in the admin app but not the live app, and that was the cause.

We also got an exception when the storage module ran in the live site, on the following line:

StorageHelper.MapStoragePath($"~/{Service.Resolve<ISiteService>().CurrentSite.SiteName}/Media/", mediaProvider);

CurentSite was null in this context, but it was fine in the admin context. We put a workaround in but it would be nice to know why that happens?

0 votesVote for this answer Unmark Correct answer

Recent Answers


Juraj Ondrus answered on November 15, 2022 09:00

What is the code of the Azure storage provider? Is this class library project also in the live site app solution and you have referenced it in the live site project? So, the live site app knows where to look for the media files. Also, are you using .NET Core or MVC5 development model?
Do you have3 the Azure configuration in appsettings or in web.config file?
What is the class library type?

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on November 16, 2022 09:28

I would say that when starting the app and loading the Azure storage provides, the current site context is not available at that time. I would recommend using hardcoded path in this case.

0 votesVote for this answer Mark as a Correct answer

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