You receive an "HTTP Error 403:Forbidden" error while you work in ASP.NET Web Application projects with SSL enabled (822322)
The information in this article applies to:
- Microsoft ASP.NET (included with the .NET Framework) 1.0
- Microsoft ASP.NET (included with the .NET Framework 1.1)
SYMPTOMSYou may receive a similar error in the following cases:
- When you create a Microsoft ASP.NET Web application in
Microsoft Visual Studio .NET and you set up Secure Sockets Layer (SSL)
certificate authentication on the ASP.NET Web application project, you may
receive the error message when you try to reopen the ASP.NET Web application
project in Visual Studio IDE:
Unable to open Web project
'AspwebApp1'. The file path 'C:\Inetpub\wwwroot\AspwebApp1' does not correspond
to the URL 'http://Localhost:/AspwebApp1'. The two need to map to the same
server location. HTTP Error 403: Forbidden -or- - You have created a virtual directory where you will create
an ASP.NET application. You enable SSL authentication in Internet Information
Services (IIS) for the project that is created in the folder. When you try to
create a new Web application project with the virtual directory name, you may
receive the following error:
Unable to create Web project
'AspwebApp2'. The file path 'C\Inetpub\wwwroor\AspwebApp2\ does not correspond
to the URL 'http://localhost/AspwebApp2'. The two need to map to the same
server location. HTTP Error 403:Forbidden
WORKAROUNDTo work around the problem, use an https URL instead of http when you open or you create a new project. To do this,
follow these steps: Open an Existing ASP.NET Project After the SSL Option Is EnabledWhen you enable the existing ASP.NET project with SSL, replace the
value of the URLPath attribute in the webinfo file from http
to https. To do this, follow these steps:
- Locate the project folder
(C:\inetpub\wwwroot\AspWebTest1).
- Open the AspWebTest.csproj.webinfo file or the
AspWebTest.vbproj.webinfo file in Notepad.
- Replace the value of the URLPath attribute
with https as follows:
<VisualStudioUNCWeb>
<Web URLPath ="https://ServerName/AspWebTest1/AspWebTest1.csproj" />
</VisualStudioUNCWeb> Note You should replace ServerName with the domain name of the server. This is the name the certificate is issued to. If there is a mismatch, you will receive the following error message: The hostname in the certificate is invalid or does not match
- Save and then close the
AspWebTest.csproj.webinfo file.
- Open the AspWebTest1 project in Visual Studio
.NET.
Create a New ASP.NET Project in SSL Enabled Virtual DirectoryCreate a virtual directory with SSL enabled, and then open
the new Web project with an https URL. To do this, follow these steps:
- Start Visual Studio .NET.
- On the File menu, point to
New, and then click Project.
- Select Visual C# Project or
Visual Basic Project under Project Types.
- Select ASP.NET Web Application.
- In the Location box, type
https://localhost/AspWebTest2.
- To create the project, click
OK.
STATUS This
behavior is by design.REFERENCES
For additional information, click the following article numbers to view the articles in the Microsoft Knowledge Base:
315588
How to secure an ASP.NET application using client-side certificates
298805 How to enable SSL for all customers who interact with your Web site in Internet Information Services
Modification Type: | Minor | Last Reviewed: | 7/8/2005 |
---|
Keywords: | kbConfig kbDeployment kbWebServer kbSecurity kbprb KB822322 kbAudDeveloper |
---|
|