I added a custom aspx page, it works but my custom master page is not being applied.

My master page resides in site collection only, so I am trying this flag to custom aspx page,

 <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="AddBlue.aspx.cs" Inherits="MyWeb.AddBlue"
 MasterPageFile="~/sitecollection/_catalogs/masterpage/masterpages/mycustom.master" %>

But I am getting this error,

The file '/_layouts/15/MyWeb/~sitecollection/_catalogs/masterpage/masterpages/mycustom.master' does not exist.

  • are you add custom page via SharePoint Designer ?or via visual studio ? Commented Apr 6, 2017 at 11:18
  • if SPD Remove this MasterPageFile="~/sitecollection/_catalogs/masterpage/masterpages/mycustom.master" then manually write MasterPageFile=" here you should find PickUp url select the correct path of masterpage Commented Apr 6, 2017 at 11:26

1 Answer 1


Fixed issue by adding


Then we have to set CustomMasterUrl of web where this page will be called from, then regardless of what masterpage your web have... this custom page will use that.

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.