Friday, May 15, 2015

Debugging a Web Application that was recently converted from Windows to Forms Authentication

If you recently converted a web application you set up to run under Windows Authentication to Forms Authentication (this would have taken place during the setup of your solution), you're likely to encounter an issue in which the debug operation is still running under Windows Authentication despite all of your changes to the web.config file to support Forms Authentication.  Anyway, the reason for this is that there are some setting in your project file that are overriding the web.config settings and they're tied to the IIS Express instance that hosts the site when you place your web application in debug mode.

To fix this problem, you can do the following:

  1. Open your web application's solution in Visual Studio 2013
  2. In Solution Explorer, click on your web application's project so that it's highlighted
  3. Hit the F4 key to open the Project Properties menu
  4. Modify your settings appropriately similar to what you did in IIS Manager when you deployed your web application to your Production environment (i.e. Windows Authentication -> Disabled and, perhaps, Anonymous Authentication -> Enabled)
  5. Save your changes and hit the F5 key to place the application in debug mode again
At this point, running your web application in debug mode will now execute in similar fashion to what you configured on your production web server for your web application.