title: set root (~) for web site in visual studio 2015
body: <p><br/>
  so this is driving me crazy...<br/>
  I'm working on a website in Visual Studio 2015 (so from the start page: File>New>Web Site...  NOT New Project>Web>ASP.NET Web Application) and things are going well when I use VS as the debugger/localshost.<br/> Now, being cautious, I want to upload the site to a <em>www.mysite.com/sandbox/</em> folder where I can test out some further items such as database access and the like (since the site is live, I don't want to replace it until I'm ready). But for some reason, all files (which worked fine through localhost) seem to point to "/" for the master pages and other items rather than "/sandbox/" ... <br/>
  Is there any way that I can tell VS that the root is not where it thinks it is?
  So far I've verified that this is purely something with the root location: I've cautiously created a different project (with file names that I can easily find &amp; delete on the live server) to see if anything is wrong on the server, but they load fine if I keep the root in the files the same as the root on the server (in other words, if I uploaded my site to the root, the references would be ok). BTW, I've done this in the past where I directly worked at the root level for a site that wasn't active and all worked well.<br/>
  Is there any way that (perhaps in web.config) I can tell it that any time I set <em>MasterPageFile= "~/Master/masterPage.master"</em> on a page it should actually point to <em>MasterPageFile= "~/sandbox/Master/masterPage.master"</em> ? I was under the impression that the "~" would take care of that, but apparently not?
  Based on Google searches, I have found that in Web Applications (rather than Web Sites) there is a way to define the 'Web' part, but that option does not seem to be available here...</p>
  
  <p>Any help would be greatly appreciated.<br/>
  Thanks,<br/>
  JoeE</p>
  
  <p>EDIT:</p>
  
  <p>So, I'm told this looks like a "wall of text" (whatever that may mean)...
  Let me give more details with a step by step for an example, perhaps someone can slap me in the right direction.</p>
  
  <ol>
  <li>Open VS2015, go to File>New>Web Site... Pick from<br>
  Installed\Tempates\Visual Basic\ASP.NET Empty Web Site -> OK</li>
  <li><p>Right-Click on the Item under the Solution and Add>Master Page, then
  edit the MasterPage.master to have this content:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %&gt;
  
      &lt;!DOCTYPE html&gt;
  
      &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
      &lt;head runat="server"&gt;
          &lt;title&gt;&lt;/title&gt;
          &lt;asp:ContentPlaceHolder id="head" runat="server"&gt;
          &lt;/asp:ContentPlaceHolder&gt;
      &lt;/head&gt;
      &lt;body&gt;
          &lt;form id="form1" runat="server"&gt;
          &lt;div&gt;
              &lt;asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server"&gt;
              Some Content from Master
              &lt;/asp:ContentPlaceHolder&gt;
          &lt;/div&gt;
          &lt;/form&gt;
      &lt;/body&gt;
      &lt;/html&gt;</code></pre>
  </div>
  </div>
  </p></li>
  <li><p>Add>Web Form (Default) and edit its contents to read:</p></li>
  </ol>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;%@ Page Language="VB" AutoEventWireup="false" MasterPageFile="~/MasterPage.master" CodeFile="Default.aspx.vb" Inherits="_Default" %&gt;
  
  &lt;asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server" &gt;
      &lt;p&gt;Some Data from Page&lt;/p&gt;
  &lt;/asp:Content&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Now I Test Run it at this point with F5 and I get a browser window that says "Some Data from Page"... as expected.</p>
  
  <p>Now comes the time to upload it to my server (hosted by 1&amp;1):</p>
  
  <ul>
  <li>Go to Build>Publish Web App   </li>
  <li>Profile>Custom Profile     </li>
  <li>Connection>Publish Method: FTP   </li>
  <li>Server: example.com   </li>
  <li>Site   Path: /sandbox/  </li>
  <li>Destination   URL:<a href="http://www.example.com/sandbox/Default.aspx" rel="nofollow noreferrer">http://www.example.com/sandbox/Default.aspx</a>   </li>
  <li>Settings>   (Kept at defaults)</li>
  </ul>
  
  <p>When I click Publish, it takes me to the Default.aspx page but states:</p>
  
  <pre><code>Parser Error 
    Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately. 
  
   Parser Error Message: The file '/MasterPage.master' does not exist.
  
  Source Error: 
  
  
  
  Line 1:  &lt;%@ Page Language="VB" AutoEventWireup="false" MasterPageFile="~/MasterPage.master" CodeFile="Default.aspx.vb" Inherits="_Default" %&gt;
  Line 2:  
  Line 3:  &lt;asp:Content ContentPlaceHolderID="ContentPlaceHolder1" runat="server" &gt;
  </code></pre>
  
  <p>Source File:  /sandbox/siteTest/Default.aspx    Line:  1 </p>
  
  <p>My question is this: where do I need to tell Visual Studio that the folder structure really contains everything under the "/sandbox/" folder rather than just "/"? I understand that I can go into the Default.aspx file and change the statement to <code>MasterPageFile="~/sandbox/MasterPage.master"</code> but there -has to be- a better way...?? I was expecting that the entry in the Publish option would do this, but it doesn't... alternatively, I tried to programmatically change this during the PreInit event, but that didn't work...</p>
  
  <p>Thanks,J</p>