Recently, we encountered a significant issue where our ASPX pages, instead of rendering and functioning as expected in the browser, started downloading as files.

Upon researching the issue online, we discovered that Microsoft has implemented a change in how SharePoint Online processes and handles custom ASPX pages. This change appears to be the root cause of the problem, as it alters the way custom pages are treated, leading to them being downloaded as files rather than displayed correctly in the browser. This shift has had a direct impact on the functionality of our custom solutions within SharePoint Online.
To resolve this issue we have to do two things:
Move the pages to Site Pages Library -> Once the pages were relocated, the issue was resolved, and they began functioning as expected.

- During our attempts to upload pages programmatically using the PnP PowerShell module, we encountered an “Access Denied” error.
Upon investigation, we discovered that the issue is caused by the DenyAddAndCustomizePages setting being enabled on the site.
To resolve this, you can disable it with the following command:
Set-Sposite -identity $siteURL -DenyAddAndCustomizePages:$false
- Unfortunately, even after disabling this setting, it automatically re-enables itself within 24 hours, and there is currently no way to permanently disable it.
As a workaround, we have incorporated this line of code directly into our scripting solution to ensure it gets disabled when necessary.
I hope this blog proves helpful if you find yourself facing a similar situation.
Thanks for reading …
Tech Wizard