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....
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With