We have one aspx page uploaded in the Document Library with basic html tags(including html and body tag). when we try to open the aspx page it redirects to /_layouts/15/download.aspx page

we have also tried the setting- use the server default(open in browser)/Open in browser in the library advance settings and tried to upload the aspx page using the upload option instead of drag and drop.


If you put an ASPX file to a document library it will be downloaded when you click on it.

So, instead of the document library, you need to put your ASPX page to a different location. For example:

  • Site Assets
  • Styles Library
  • Site Pages

If you put your HTML Page (with an aspx extension) to any of the above, it will open just fine.

However, there is one caveat. By default, "Add And Customize Pages" right is denied on the modern site collections. This is why you have to disable this security feature before you can upload a custom ASPX page:

Install-Module -Name Microsoft.Online.SharePoint.PowerShell    
Connect-SPOService -Url https://tenant-admin.sharepoint.com 
Set-SPOSite -Identity https://tenant.sharepoint.com/sites/ModernTeam -DenyAddAndCustomizePages $false

enter image description here

enter image description here

  • Thanks for providing the solution. After providing "Add And Customize Pages" permissions the .aspx page is working in all document libraries. – Harminder Singh Jan 1 '20 at 9:54

What’s the permission of the user?

Make sure the user have "Add and Customize Pages permission" via checking permission in the site settings->site permissions->check permission.

If the issue still exists, how did you create the aspx page? Try to go to SharePoint Designer 2013 ->site pages->Page->create a new aspx page and check if it can be opened in the browser.

enter image description here


Disable parameter setting "DenyAddAndCustomizePages".

Here's the PowerShell code to do so:

Set-SPOsite https://xxx.sharepoint.com/sites/teamxyz -DenyAddAndCustomizePages 0

Then upload the .ASPX file as Site Owner to the document library. It won't work if you just have "Member" permissions to the site.

New contributor
Tech Muse is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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