M
Mark Olbert
I have been wrestling with FormsAuthentication working on some, but not all, of my development
websites. I think I've determined what is causing the problem, but I can't figure out the
workaround/solution to use in the VS.NET environment.
Background: I recently changed my development environment so that, instead of having access to only
one website at a time on my WinXP development machine I now "host" the sites on a backend Win2K
server. This is all on an intranet; no traversal of the public internet takes place.
To differentiate among the different sites I use multihoming, with each site getting a unique IP
address in the 192.168.1.xxx range. I should point out that the same problem whose "solution" I
describe here also occurred when I was >>not<< using multihoming, but different host header names
instead.
After making that switch, and transitioning the development sites to the Win2K server, I found that
certain Forms Authentication setups that had been running well for months suddenly stopped working.
I confirmed this problem in a stripped-down test application that has only two forms, one a login
form and one an empty form in a protected subdirectory of the site. No real authentication is done;
clicking on the Submit button of the login from simply calls:
FormsAuthentication.RedirectFromLoginPage("user1", true);
Note that this call sets up, or should set up, a persistent cookie.
Only it doesn't. No cookie at all is created, and so the user gets continually bounced back to the
login form.
After researching this for hours on google groups and msdn I came across an old MSDN article
entitled Internet Explorer Drops Site Server Cookie for Intranet Site IP Address (279186). The
article, which dates back to 2002, talks about a problem that can be cured by using the numeric IP
address for an intranet site, rather than its human-readable name.
In desperation I tried (outside of VS.NET) accessing the site with a numeric IP...and the cookie was
created! Authentication succeeded, and I was able to see the protected page.
Accessing the site using the human readable name continued to fail outside of VS.NET, as it had
inside of the development environment.
This problem seems to me to be very serious, in that how the heck can a developer "host" multiple
projects on an intranet that use FormsAuthentication if some of them succeed and some of them
fail???
I anxiously await feedback from Microsoft on how to fix this stupid problem.
- Mark
websites. I think I've determined what is causing the problem, but I can't figure out the
workaround/solution to use in the VS.NET environment.
Background: I recently changed my development environment so that, instead of having access to only
one website at a time on my WinXP development machine I now "host" the sites on a backend Win2K
server. This is all on an intranet; no traversal of the public internet takes place.
To differentiate among the different sites I use multihoming, with each site getting a unique IP
address in the 192.168.1.xxx range. I should point out that the same problem whose "solution" I
describe here also occurred when I was >>not<< using multihoming, but different host header names
instead.
After making that switch, and transitioning the development sites to the Win2K server, I found that
certain Forms Authentication setups that had been running well for months suddenly stopped working.
I confirmed this problem in a stripped-down test application that has only two forms, one a login
form and one an empty form in a protected subdirectory of the site. No real authentication is done;
clicking on the Submit button of the login from simply calls:
FormsAuthentication.RedirectFromLoginPage("user1", true);
Note that this call sets up, or should set up, a persistent cookie.
Only it doesn't. No cookie at all is created, and so the user gets continually bounced back to the
login form.
After researching this for hours on google groups and msdn I came across an old MSDN article
entitled Internet Explorer Drops Site Server Cookie for Intranet Site IP Address (279186). The
article, which dates back to 2002, talks about a problem that can be cured by using the numeric IP
address for an intranet site, rather than its human-readable name.
In desperation I tried (outside of VS.NET) accessing the site with a numeric IP...and the cookie was
created! Authentication succeeded, and I was able to see the protected page.
Accessing the site using the human readable name continued to fail outside of VS.NET, as it had
inside of the development environment.
This problem seems to me to be very serious, in that how the heck can a developer "host" multiple
projects on an intranet that use FormsAuthentication if some of them succeed and some of them
fail???
I anxiously await feedback from Microsoft on how to fix this stupid problem.
- Mark