Freigeben über


We were unable to open ASP.NET Projects while using Forms Authentication

Few days back, I saw a very interesting issue. Thought, I must share it…

 

Background

==========

1) Customer wanted to use Forms based authentication in his web application

2) He add the following in his machine.config

    <add verb="*" path="*.htm" type="System.Web.UI.SimpleHandlerFactory"/>

3) He also added ".htm" and mapped it to "c:\windows\microsoft.net\framework\v1.1.4322\aspnet_isapi.dll"

 

What was happening??

=================

Ø We were able to browse the directly from the IIS, but when he tries to open/create the project from the IDE he was getting the following errors.

 

First Error

The default Web access mode for this project is set to file share, but the project folder at 'https://localhost/TestWebApp' cannot be opened with the path 'C:\Visual Studio 2003 Projects\TestWebApp'

Unable to open Web Project 'TestWebApp'. The file path 'C:\Visual Studio 2003 Projects\TestWebApp' does not correspond to the URL 'https://localhost/TestWebApp'. The two need to map to the same server location. HTTP Error 500: Internal Server Error

 

Second Error

Unable to open Web Project 'TestWebApp'. The file path 'C:\Visual Studio 2003 Projects\TestWebApp' does not correspond to the URL 'https://localhost/TestWebApp'. The two need to map to the same server location.

 

Ø Found that he was using File Share mode in the IDE to open/create the web projects

Ø In the IIS Logs, we were seeing

 

16:08:55 127.0.0.1 GET /TestWebApp/get_aspx_ver.aspx 302

16:08:55 127.0.0.1 GET /TestWebApp/Login.aspx 200

16:09:46 127.0.0.1 GET /TestWebApp/vs-11204898229752538_tmp.htm 302

16:09:46 127.0.0.1 GET /TestWebApp/Login.aspx 200

16:09:46 127.0.0.1 GET /TestWebApp/get_aspx_ver.aspx 302

16:09:46 127.0.0.1 GET /TestWebApp/Login.aspx 200

 

How we resolved the issue

=====================

As can be seen from the IISLogs the problem arises because of the vs-####_tmp.htm. When the IDE tries to create a temporary .htm file, that request was getting redirected to Login.aspx, due to Forms Authentication and the IDE got confused that the project is not present at the specified location.

 

1) So, changing the ".htm" mapping in the IIS to ".html" in the IIS Fixed the issue. Now, he is able to open the projects as expected.

2) Also, if we change the File Share mode to Front Page Server Extensions, the issue goes away.