Where is GetFile.aspx page?

Hanh Dang asked on March 10, 2017 05:43

Hi all,

I have an issue about allowing public user to download file from media or not. In Kentico 9 or older, I can store conditions in session and write some custom code in GetFile.aspx.cs page to check it. But I cannot find that file in Kentico 10.

Does anyone know where is it or its replacement in Kentico 10?

Correct Answer

Pavel Jiřík answered on March 10, 2017 10:40

Hi Hanh,

The GetFile.aspx.cs file has been removed in Kentico 10. Instead, a mapped handler is used to handle these requests. The implementation of the handler is in the CMS.DocumentEngine.GetAttachmentHandler class. However, you would need a source code license to be able to change its code.

Depending on your needs, you may create a handler for the RequestEvents.End.Execute event and implement your custom logic there. To check if the request is being processed by GetAttachmentHandler, you can use the following condition in the handler:

if(CMSHttpContext.Current.Handler is IGetAttachmentHandler) { do something }

I hope it helps!

1 votesVote for this answer Unmark Correct answer

Recent Answers


Lei Kin Man answered on March 15, 2017 09:47 (last edited on March 15, 2017 10:14)

Hi Pavel Jiřík,

 For some security reasons, we want to mask/change the filename of attachment by modifying the response header. Before version 10, we can implement custom code at GetFile.aspx.cs. But now, how can I implement the same logic?

Thanks & Regards, Louis Lei

0 votesVote for this answer Mark as a Correct answer

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