Displaying custom "FILE" page type

Rita Mikusch asked on May 2, 2018 23:11


I've cloned the cms.File page type to create my own custom cms.TestFile page type. And I've created a custom "NewTestFile.aspx" page, so my files now upload successfully.

But when I go to the URL for my uploaded file (of type cms.TestFile), it's not treating it as a file ... it's treating it as a regular kentico content page.

What do I need to customize to make kentico treat my uploaded files of type cms.TestFile as a FILE?

Is there anything else I need to customize that I haven't thought of yet?

Clarification: I would like the URL to that cms.TestFile page to go directly to the FILE that was uploaded. For example, the following URL would open the file that was uploaded. https://www.example.com/myTestFile.pdf/

Thank you.

Recent Answers

Juraj Ondrus answered on May 4, 2018 14:02

You will need to add your custom logic to return correct content type in the header - that's why there is the CMS.File page type and we have the logic in our code. What is the reason to create a custom page type? You can achieve the same with the CMS.File page type too. You just need to configure the extensions

0 votesVote for this answer Mark as a Correct answer

Rita Mikusch answered on May 4, 2018 17:38

Thank you. I spent some time last night searching for info on "cms.File", and found similar information.

I need to put certain restrictions on SOME of these files, and it seemed easier to do that when these files all have a specific class type. Then I can add a custom handler that targets just that class.

0 votesVote for this answer Mark as a Correct answer

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