title: Asp.net: relative paths not working when deployed IIS
body: <p>I spent almost 2-3 good hours on this and im here now, as the question states. The project works fine in VS but when I deploy/publish it through IIS (to access it on local network) some files (well most of them) aren't accessible. This happened when I added the Metronic theme within my web project. The files are like:</p>
  
  <pre><code>  &lt;!-- BEGIN GLOBAL MANDATORY STYLES --&gt;
      &lt;link href="http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700&amp;subset=all" rel="stylesheet" type="text/css" /&gt;
      &lt;link href="../../assets/global/plugins/font-awesome/css/font-awesome.min.css" rel="stylesheet" type="text/css" /&gt;
      &lt;link href="../../assets/global/plugins/simple-line-icons/simple-line-icons.min.css" rel="stylesheet" type="text/css" /&gt;
      &lt;link href="../../assets/global/plugins/bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" /&gt;
      &lt;link href="../../assets/global/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" /&gt;
      &lt;!-- END GLOBAL MANDATORY STYLES --&gt;
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>&lt;img src="../assets/pages/img/logo.png" alt="place Logo Here" /&gt;
  </code></pre>
  
  <p>Now once its published, it throws me a pile of errors that it could not find any of those files.</p>
  
  <p><img src="https://i.stack.imgur.com/wTECI.png" alt="State when running on VS"></p>
  
  <p><img src="https://i.stack.imgur.com/NgmDE.png" alt="State Once its published to IIS"></p>
  
  <p>Notice: the url in both the pictures, the deployed project is under another folder. is it the culprit? </p>
  
  <p>I am trying to figure out a solution that works for both VS debugging and the deployed project.</p>
  
  <p>What I have tried is:</p>
  
  <p>1: <a href="https://weblogs.asp.net/scottgu/tip-trick-how-to-run-a-root-site-with-the-local-web-server-using-vs-2005-sp1" rel="nofollow noreferrer">https://weblogs.asp.net/scottgu/tip-trick-how-to-run-a-root-site-with-the-local-web-server-using-vs-2005-sp1</a></p>
  
  <p>2: <a href="https://stackoverflow.com/questions/1446728/deploying-asp-net-application-to-root-directory-in-iis">Deploying asp.net application to root directory in IIS</a></p>
  
  <p>3: <a href="https://stackoverflow.com/questions/11912449/how-to-avoid-deploying-asp-net-mvc3-application-in-subpath-on-iis-7-5?noredirect=1&amp;lq=1">How to avoid deploying ASP.NET MVC3 application in subpath on IIS 7.5</a></p>
  
  <p>4: <a href="https://stackoverflow.com/questions/11866865/asp-net-webforms-why-do-relative-paths-within-user-controls-work-locally-but-n">ASP.NET WebForms: Why do relative paths within user controls work locally, but not when deployed?</a></p>
  
  <p>5: <a href="https://stackoverflow.com/questions/1449267/iis-virtual-directory-and-asp-net-directory-paths">IIS virtual directory and ASP.NET directory paths</a></p>
  
  <p>6: <a href="https://stackoverflow.com/questions/7960094/relative-path-from-site-root">Relative path from site root</a></p>