title: ASP.NET separate web / admin applications
body: <p>I've often developed websites in asp.net webforms with an administration area which is always a folder in the root of the application, where the site also lives. Which will always be compiled into one dll, meaning every small change requires full re-build of a solution - it just doesn't <em>work</em> well.</p>
  
  <p>This is quite a lengthy question so my <strong>summary is at the bottom</strong>, but I've tried to give as much information as possible to help.</p>
  
  <p>So at the moment things are set up something like this (you should get the idea):</p>
  
  <pre><code>¬ Application Root  
    -  /MyAdminPanel
       - dashboard.aspx
    -  /website-css
       - site.css
    - index.aspx
  </code></pre>
  
  <p>However I've recentley starting developing our sites with ASP.NET MVC and using multiple projects in a solution, like:</p>
  
  <pre><code>¬ Solution
    - ClientName.Core
    - ClientName.Models
    - ClientName.CMS.Services
    - ClientName.CMS.Web
    - ClientName.Services
    - ClientName.Web
  </code></pre>
  
  <p>the <code>.Web</code> projects being the CMS and front facing websites.</p>
  
  <p><strong>Is there a better way for me to structure my IIS applications bearing in mind that 99% of the time there will be an administration area for the website?</strong></p>
  
  <p>There are concerns regarding resources that are uploaded through the administration panel that need to be accessed via the front facing website, so essentially out of the child application and into the root.<br>
  This is possibly by doing <code>Server.MapPath(string path)</code> as that will go to the root application, however depending on how things were set up, it could potentially not be guaranteed that the root application is where the file needs to go (for instance if both the front and admin facing sites were both in separate virtual applications).<br>
  I'm thinking about the situation here if using <code>HostingEnvironment.MapPath()</code> where the path would actually resolved to the <code>/MyAdminPanel</code> child application, which would obviously not be correct.  </p>
  
  <p><strong>Summary</strong><br>
  In essence, to cut a very long story short, an ideal situation would be to have a VS solution as mentioned above, with a similarly structured website (though I am more that happy for this to change to something better), where I can <code>MapPath</code> resources to the front facing website and not worry how the website is hosted.</p>
  
  <p><strong>One thing that is important though is that I can build and maintain the projects separately, as some administration will have different functionality from one client to another</strong></p>
  
  <p>If you can come up with a much better structure for all of this, I am more than happy to listen! :)</p>
  
  <p>Thanks for taking the time to check this out.</p>