Unable to open Web Project '...'. The file path '...' does not correspond to the URL '...'. The two need to map to the same server location. HTTP Error 403: Access Forbidden

I got this error (and serveral variations of it while trying to fix it) when trying to open an ASP.NET (.Net 1.1) web app in VS.NET (2003) (on an XP Pro box):

Unable to open Web Project 'TestW'. The file path 'C:\inetpub\wwwroot\TestW' does not correspond to the URL 'http://Localhost:/TestW'.  The two need to map to the same server location.  HTTP Error 403: Access Forbidden

This was caused by two problems:

  1. I had added a certificate to the server (IIS 5) - and the cert specified my full machine domain name.
  2. I had changed the web app's security setting to 'Require secure channel (SSL)'.

To resolve this I had to do the following:

  1. Remove the offending web app project from the VS.NET solution & save the solution.
  2. Using a test editor (eg Notepad), open the .webinfo file of the offending project (eg C:\Inetpub\wwwroot\TestW\TestW.csproj.webinfo).
  3. Update the 'URLPath' attribute of the 'Web' element to use the full host name (required for cert) and to use https (required for SSL) eg:
    Replace this:

    With this:
  4. Save the webinfo file.
  5. Within VS.Net, right-click on the solution and select Add - Existing Project From Web....
  6. Enter the new URL, identical to what you just saved in the webinfo file.  Eg:  
    https://iblongsw70991.gb.ad.drkw.net/TestW/TestW.csproj
  7. Save it all and cross your fingers ;-)

HTH

Tim

This article is part of the GWB Archives. Original Author: Tim Huffam

New on Geeks with Blogs