I have a simple static HTML site, renamed to ASPX, and then uploaded to SharePoint, see the procedure as described here:

How to host static HTML sites on modern SharePoint site collections.

This ASPX file works fine in two of my Teams- and SharePoint sites, respectively.

I can edit the ASPX file locally (via my OneDrive), and the changes will be uploaded and displayed correctly as web page in the browser.

However, this only works in two out of four of the Teams/SharePoint pages that I have tested it with, namely the two below named "T" and "TT", respectively, with green logos.

various teams/SharePoint pages

In the other two named "PA" and "A", respectively, the ASPX web page only works after the initial upload (after the website files have been copied over from one of the working sites, within SharePoint).

As soon as I edit the respective ASPX files locally, and after they are uploaded to "PA" or "A", respectively, they are not shown in the browser anymore. Instead, the browser downloads the ASPX file, as if Custom Scripts were not enabled.

What could be the reason that the ASPX file only works on some of my SharePoint sites and not on others?

Does the activation of Custom Scripts not apply to all my SharePoint pages, but must be activated separately for each SharePoint page?

Edit: I noticed that the ASPX files that don't work in the browser each have two occurrences of the following lines added to them, as soon as they are uploaded to SharePoint:

<%@ Register Tagprefix="SharePoint"
 Assembly="Microsoft.SharePoint, Version=, Culture=neutral,
 PublicKeyToken=[some long hex number]" %>

Why would this code only be added in the two SharePoint sites named "PA" and "A" as shown above, but not in the other two named "T" and "TT"?

  • This is what ChatGPT just said about the issue😯: "If this code is automatically added when an ASPX file is uploaded to a SharePoint page, it indicates that custom scripts are disabled for that SharePoint page. This code represents a register directive that specifies that the Microsoft.SharePoint.WebControls namespace should be used in a particular assembly. Because this code is added automatically, the ASPX file may not be interpreted as a valid Web page and may instead be offered as a download."
    – David.P
    Commented Feb 5, 2023 at 19:08

1 Answer 1


I encountered this issue as well. The culprit for me was a third-party SharePoint add-in that was configured to perform some actions on the library where the aspx file was being uploaded. Once I removed the actions, the aspx files stopped automatically updating with the register and <!--[if gte mso 9]><SharePoint:CTFieldRefs... tags. I would suggest inspecting the libraries where the aspx files are uploaded for any differences. Hope this helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.