38,722 total views, 11 views today
Open aspx file Online – many times we might observe strange behavior in modern SharePoint Online while we upload a custom .aspx file in SharePoint Pages or Site Pages library, and try to open it in the browser – what will happen is, it will be downloading the .aspx file instead of browsing – so, in this article, we will learn about how can we open the aspx page or file in the browser instead of downloading the file?
Solution: Open aspx file Online
In order to fix the above issue or to open the .aspx file in the browser instead of downloading it, we need to enable custom scripting on that said site.
Below is the PowerShell script using which we can enable the custom scripting feature in the modern SharePoint Online site.
It is a two steps process, first, we need to enable the custom scripting at the tenant level, then at the site level.
Enable custom scripting at the tenant-level through modern admin center UI (Open aspx file Online)
Go to your tenant setting page thru this URL
Note: Here “sprnd” is my tenant name, you need to pass your tenant name.
Now see the “Custom Script” section by default both the radio button is selected as prevent – this is the default behavior and due to this script editor and content editor web part is missing from SharePoint online page.
- Prevent users from running custom script on personal sites.
- Prevent users from running custom script on self-service created sites)
Now select to allow users to run the custom script for both the radio button as below:
- Allow users from running custom script on personal sites.
- Allow users from running custom script on self-service created sites)
Now click on ok and once you save it, this may take 24 hours to reflect the changes.
How to enable the custom scripting using the PowerShell script(Open aspx file Online)?
Execute the below PowerShell script to enable the custom scripting in SharePoint Online (specific site).
$adminUserID="youradminaccount@< sprnd.onmicrosoft.com>" $userCredential = Get-Credential -UserName $adminUserID -Message "Enter password" Connect-SPOService -Url https://sprnd-admin.sharepoint.com/ -Credential $userCredential Set-SPOsite "https://sprnd.sharepoint.com/sites/TestSite001" -DenyAddAndCustomizePages 0
Summary: Open aspx file Online
Thus, in this article, we have learned about how to enable custom scripting in SharePoint Online specific sites and fix the issue of opening a custom aspx page in the browser.
See Also: Open aspx file Online
You may also like the below SharePoint troubleshooting articles:
- SharePoint Online – O365: How to enable script editor web part in SharePoint online
- [Fixed] Error – activate the SharePoint Server Publishing Infrastructure feature in SharePoint Online site
- [Fixed] Server relative urls must start with SPWeb.ServerRelativeUrl”in reading web part properties!
- [Fixed]: The page could not be created. Custom Scripting might be deactivated on the destination site or you might not have sufficient permissions.
- [Fixed] The upgraded database schema doesn’t match the TargetSchema(Failed to upgrade SharePoint Products)
- [Fixed] “Sorry, something went wrong. There was an exception in the Database” (SharePoint Server Error)
- [Fixed] How to fix the “Unexpected response from server. The status code of response is ‘500’ in SharePoint 2016 Search error.”?
- [Fixed] How to fix the wrong tenant credential error in SharePoint online?
- [Fixed] How to fix request timed out error in SharePoint 2016 search (There was no endpoint listening)?
- [Fixed] How to Fix a SharePoint 404 Error in sub site After Restoring a Content Database?
- Use multiple environments in ASP.NET Core
If this article helps you, please appreciate our efforts by writing a comment below or if you have a better idea/solution to this topic, please write a comment, we will include that in this article. Thank you, happy reading, learning, and Sharing. 🙂