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

  • We Won The One Award I Actually Care About

    Full Scale made the Inc. 5000 for the fifth year straight, the 12th listing across my three companies. Here is why the one award you cannot buy is worth stopping for.

  • Your Customers Build the Features Now

    I let a tool I liked sit dead for a year rather than build the features I wanted. An MCP server meant I never had to, and your customers can do the same to your product.

  • Get the Size of a Directory in Linux the Easy Way

    du -sh for the quick answer, ncdu for the cleanup, df for the disk itself: every command for checking directory size in Linux, plus why du and df never agree.

  • Vim Search and Replace: The Ultimate Guide

    One :%s command replaces every match in a file before a find dialog would even open. The Vim substitute patterns worth the muscle memory: flags, ranges, capture groups, and multi-file edits.