title: How to use the site's masterpage from a _layout SharePoint page?
body: <p>I want to use a masterpagefile (the site's one if this makes sense) in my SharePoint 12 hive/template/layouts/TelephoneBookList/test.aspx file. However, whenever I add MasterPageFile="~/_layouts/simple.master" or something like that to my test.aspx page, I get a sharepoint error page and the following in the log file:</p>
  
  <p>01/12/2009 10:56:26.95  w3wp.exe (0x1064)                           0x1280  Windows SharePoint Services     Topology                        0   Critical    Invalid URL: <a href="http://localhost" rel="nofollow noreferrer">http://localhost</a>.  You may also need to update any alternate access mappings referring to <a href="http://mcdevsp" rel="nofollow noreferrer">http://mcdevsp</a>.  Help on this error: <a href="http://go.microsoft.com/fwlink/?LinkId=114854" rel="nofollow noreferrer">http://go.microsoft.com/fwlink/?LinkId=114854</a>    </p>
  
  <p>01/12/2009 10:56:27.09  w3wp.exe (0x1064)                           0x1280  Windows SharePoint Services     General                         8dzz    High        Exception Type: System.Web.HttpException  Exception Message: The file '/_layouts/TelephonebookList/~masterurl/default.master' does not exist.   </p>
  
  <p>01/12/2009 10:56:27.23  w3wp.exe (0x1064)                           0x1280  Windows SharePoint Services     Topology                        0   Critical    Invalid URL: <a href="http://localhost" rel="nofollow noreferrer">http://localhost</a>.  You may also need to update any alternate access mappings referring to <a href="http://mcdevsp" rel="nofollow noreferrer">http://mcdevsp</a>.  Help on this error: <a href="http://go.microsoft.com/fwlink/?LinkId=114854" rel="nofollow noreferrer">http://go.microsoft.com/fwlink/?LinkId=114854</a>    </p>
  
  <p>01/12/2009 10:56:27.70  w3wp.exe (0x1064)                           0x1280  Windows SharePoint Services     General                         8dzw    Medium      spHttpHandler:GetHash started    </p>
  
  <p>01/12/2009 10:56:27.70  w3wp.exe (0x1064)                           0x1280  Windows SharePoint Services     General                         8dzx    Medium      spHttpHandler:GetHash finished   </p>
  
  <p>Without the MasterPageFile attributes, it works perfectly, however it does not have the global Look &amp; Feel of the web site.</p>
  
  <p>Many thanks.</p>