Forum Discussion

Ashley_Nicholson's avatar
Ashley_Nicholson
Copper Contributor
Jul 18, 2024

Custom ASPX files are downloading, not running.

Hi All,

 

I have some custom ASPX files on a SharePoint site. When you click on them, they run a html file (saved as ASPX). However, if I create a new file in the same vein, when a user clicks on it, it downloads instead of running.

 

Even if I copy an existing file and paste in the same folder, the existing file will continue to run as intended however the new file will download, even though the file is identical. 

 

Has anyone experienced any similar issues, or know of a solution? Thanks.

5 Replies

  • If new ASPX files download instead of executing, it usually means SharePoint Online is not treating the file as a server-rendered page. This can happen when the file is created outside SharePoint Designer or when the library has custom scripting disabled.

    Key things to check:

    • Ensure the site allows custom script. In modern tenants, custom scripting is disabled by default, so newly uploaded or created ASPX files are served as downloads instead of being executed.
    • Files already present before custom script was disabled will continue to run, which explains why older ASPX files still work but newly created ones do not.
    • Verify that the library is not in a restricted mode such as a library requiring “No script” settings.

    Enabling custom script at the tenant or site level restores normal behavior, and newly created ASPX files will run instead of downloading.

  • Nigel1's avatar
    Nigel1
    Occasional Reader

    Any change to this?
    I have the same issue but custom scripts are approved.

  • etbrunet's avatar
    etbrunet
    Copper Contributor

    Hi all,

    I have the same issue here. I have an .aspx file that has been running for years. Example if I copy the same file/different name in the same folder it will download. These are the kinds of things that drive me crazy; why?

  • Ashley_Nicholson custom site scripts are blocked. So, aspx files wouldn't be able to run because of that setting:

    https://learn.microsoft.com/en-us/sharepoint/allow-or-prevent-custom-script#features-affected-when-custom-script-is-blocked

     

    When you try to allow it the custom script settings for a specific site only lasts for a maximum of 24 hours. After that time, the setting will reset to its original blocked value for that specific site.

    What are you trying to present in those aspx pages? 

     

    • Ashley_Nicholson's avatar
      Ashley_Nicholson
      Copper Contributor
      The article is very recent. Does this signify that it's a recent change?

      Any previously uploaded files still function perfectly, but new ones don't. Is there any reason why old ones wouldn't work?

      If I allow the custom settings, and the file works, will it stop working after 24 hours? Or will I just have to test that and see?

      The content is iframe embedded and presents as an animated button that opens a window to a URL with a specific window size. The destination and the URL can be customised. These buttons are then presented on various different pages where applicable.

Resources