Kentico 12 CMS.File resulting 404 Not Found on MVC site

Jamie S asked on August 12, 2020 10:09

After adding a new Page (CMS.File) to the Kentico tree and uploading the file, the produced links to the page, including, alias path, preview and live all result in 404 Page Not Found.

Symptoms would suggest that the content isn't being synchronised to the MVC site. However, there are no pertaining errors in the Event Log application.

I tried the same process with K11 Portal Engine and had no issues.

Any insight would be grateful.

Correct Answer

Trevor Fayas answered on August 18, 2020 23:39

As Juraj pointed out, you'll need a custom page type and controller.

Here's from the Kentico 12 baseline:

https://github.com/HBSTech/Kentico12Baseline/blob/master/MVC/MVC/Controllers/PageTypes/FileController.cs

Although i should have put the GetAttachmentinfo in a separate repo, but you can get the general idea.

1 votesVote for this answer Unmark Correct answer

Recent Answers


Arjan van Hugten answered on August 12, 2020 11:03

What is the link that you get with the CMS.File page? I had an issue with my url containing 'getdoc' instead of 'getfile'. This caused the 404 in my case.

0 votesVote for this answer Mark as a Correct answer

Jamie S answered on August 12, 2020 23:52

The preview link employs the getdoc, I changed to getfile and still a 404.

0 votesVote for this answer Mark as a Correct answer

Juraj Ondrus answered on August 13, 2020 11:25

The CMS.File page type should be used for portal engine mainly. If you want to make the links work, then you need to create appropriate routing and MVC code to handle this page - basically as for any other pages. Keep in mind that the MVC app is the one who serves the content - so you need to have the logic implemented there.

1 votesVote for this answer Mark as a Correct answer

Jamie S answered on August 19, 2020 00:38

Solid answers, @Trevor, that is the approach I ended up taking a few days ago, but was slack at replying. Thank you

0 votesVote for this answer Mark as a Correct answer

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