This is related to Link to "Download a Copy" from a Document Library
I use /_layouts/download.aspx?SourceUrl=/sites/sitename/library/folder/fileName.aspx to download files in my application. However, I get an access denied message, if try to download an ASPX file. It works with any other file type though. I am using SP 2016.
Is there a way to make it work with ASPX files?
EDIT: Sorry, I should've given more context: I'm using a Java console app. The Java console app copies all the files from a given library to the HDD. It works fine with any file type we have: docx, xls, pdf, etc., but not with ASPX. We used to use SP 2013, and now we have migrated the SP to SP 2016. SP 2013 supports HTML extensions - can be served as web pages, so we did not face any issue there. However with SP 2016, we can only use ASPX extensions for web pages. Now we get permission denied error when using: http://site/_layouts/download.aspx?SourceUrl=/sites/sitename/library/folder/fileName.aspx