Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

~masterurl/default.master does not exist

I try to create a custom webpart page. I tried a book example that start with :

<%@ Page MasterPageFile="~masterurl/default.master"
Inherits="Microsoft.SharePoint.WebPartPages.WebPartPage,
          Microsoft.SharePoint, [full 4-part assembly name]"
meta:progid="SharePoint.WebPartPage.Document" %>

....but no result.... The page is deployed into _layouts folder but when I try to access it from browser I get : "_layouts/~masterurl/default.master does not exist". What I do wrong ?

Thank you in advance !

Solved the problem : read again the book and indeed I did not have to add the page to _layouts folder. Thank you for opening my eyes :). All steps are well explain in the book but I was not concentrating enough. Yes, one down....

like image 681
Ciprian Grosu Avatar asked Jul 27 '26 16:07

Ciprian Grosu


2 Answers

You first need to decide weather your page is going to be a Site Page (meaning it lives in a document library or directly in the Web), or if it is going to be an Application Page. If you deploy the page to the _layouts folder you're telling SharePoint this is an Application Page.

If you look at other _layouts pages, they have the format

<%@ Page language="C#" MasterPageFile="/_layouts/application.master"      Inherits="..." %>

You could change application.master to a different file then.

This is only one way to do this, however I believe that are other options depending on how dynamic you want the master page file to be.

like image 150
Jon Schoning Avatar answered Jul 30 '26 10:07

Jon Schoning


It just doesn't like the ~masterurl part.

I've used ~/_catalogs/masterpage/filename.master and that works perfectly. Not dynamic, but it works fine for our environment.

like image 30
PhilD Avatar answered Jul 30 '26 08:07

PhilD