Follow

How can I open the aspx file in the browser instead of downloading the file?

After uploading the files and clicking on the aspx file the file is downloaded. How can I avoid this?

Use one of the following methods.

  1. Upload the aspx file using your browser’s upload button.
    i.e. do not use “drag and drop” or sync via OneDrive for Business client.
  2. Allow use of scripts in SharePoint Online
    See https://www.sharepointdiary.com/2017/12/how-to-enable-custom-script-in-sharepoint-online.html “How to Enable Custom Script in SharePoint Online?

    To allow custom script in SharePoint Online, follow these steps:
    a. Sign in to Office 365 and go to the SharePoint Online Admin Center.
    b. Click on Settings from the left navigation and open the classic settings page by clicking "Classic Settings Page"
    c. Scroll down to "Custom Script" section
    Under Custom Script section, Set "Allow users to run custom script on personal site" and "Allow users to run custom script on self-service created sites" options.
    d. Click on "OK" to save your changes.

    NB: This enables custom scripting in SharePoint Online. However, this change may take up to 24 hours or more to reflect. Check if the change has been processed in the SharePoint Admin Center.
    e. Delete the existing aspx file from SharePoint and upload the aspx file using the SharePoint Upload button (i.e. do not use drag and drop).
  3. Use PowerShell to instantly change the configuration
    SPO PowerShell
    Connect-SPOService https://<yourinstance>-admin.sharepoint.com/

    Set-SPOsite https://<yourinstance>.sharepoint.com/sites/<yoursite> -DenyAddAndCustomizePages 0
    or
    PnP PowerShell
    Connect-PnPOnline -PnPManagementShell -Url https://<yourinstance>.sharepoint.com/
    Set-PnPSite https://<yourinstance>.sharepoint.com/sites/<yoursite> -NoScriptSite $false

    Remove the existing aspx page and then upload the aspx file again
    Note: it will not work if you only have "member" permissions on the site
Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk