C
Competitive Dad
I need to have a site that supports both of the above schemes.
I have created the site and published it to a folder and have set up two
virtual directories on the folder, one with Anonymous enabled, the other with
Windows Authentication.
I have a login/logout button that when clicked does a simple redirect to the
appropriate site. I am checking
HttpContext.Current.User.Identity.IsAuthenticated to decide what to do.
The site is identical in both cases, and the web.config is set as:
<authentication mode="Windows" />
<identity impersonate="true" />
Now this all works fine, if I start on Anonymous click the login button I'm
directed to the Windows URL and access to resources is correct.
If I then click the login/logout button again, this also works and I get
sent back to the Anonymous URL and the resource access is correct.
If I then try clicking the login/logout button for a third time, I am just
left in the Anonymous site and am never taken to the Windows URL.
I've tried IsAuthenticated, I've tried checking User.Identity.Name.Length
and all manner of other things as my test to redirect and nothing seems to
work.
Anyone got anything else I could try or advice on why it is not working?
Many thanks,
CD
I have created the site and published it to a folder and have set up two
virtual directories on the folder, one with Anonymous enabled, the other with
Windows Authentication.
I have a login/logout button that when clicked does a simple redirect to the
appropriate site. I am checking
HttpContext.Current.User.Identity.IsAuthenticated to decide what to do.
The site is identical in both cases, and the web.config is set as:
<authentication mode="Windows" />
<identity impersonate="true" />
Now this all works fine, if I start on Anonymous click the login button I'm
directed to the Windows URL and access to resources is correct.
If I then click the login/logout button again, this also works and I get
sent back to the Anonymous URL and the resource access is correct.
If I then try clicking the login/logout button for a third time, I am just
left in the Anonymous site and am never taken to the Windows URL.
I've tried IsAuthenticated, I've tried checking User.Identity.Name.Length
and all manner of other things as my test to redirect and nothing seems to
work.
Anyone got anything else I could try or advice on why it is not working?
Many thanks,
CD