Programatically change authentication mode at startup of web app?



Is there any way to change the authentication mode of a web app during
startup, say in the globl.asax.cs file? (if you are using c# of
course).

I have a situation where in some cases I need to use forms
authentication and sometimes I need windows authentication. They both
work fine stand-alone with static web.config files, but I need to make
the decision programatically based on external factors. Is this
possible?

I've already tried trapping the Application.Start event in
global.asax.cs and mucking with the properties of the
AuthenticationSection and AuthorizationSection objects that are loaded
from web.config, but even though they can be changed at runtime there
seems to be no effect.

Mike

.



Relevant Pages

  • SetAuthCookie in Application_AuthenticateRequest
    ... I'm using Forms authentication. ... Right after the end of the event I'm redirected to my logingurl that I ... If the cookie is already set shouldn't I just go to my startup page ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: Single sign-on between web & desktop
    ... web app, starting with something like ASP.NET forms authentication is ... Joe Kaplan-MS MVP Directory Services Programming ... "User credentials come from a Windows domain" should be "User ...
    (microsoft.public.dotnet.security)
  • Re: 401 Access Denied while accessing WSE 3.0 WebService
    ... I also tried impersonating an account ... web app. ... > what kind of authentication you have turned on in IIS? ... > the ASPNET user access to the WS and all dependant resources thereof? ...
    (microsoft.public.dotnet.framework.webservices.enhancements)
  • Re: Tell me about security/privacy issues with .NET/mono
    ... Passport authentication is not _required_ in .NET applications. ... but from a .NET point of view the authentication mode is still ... not an external, 3rd party authentication process, it is a built-in ...
    (comp.os.linux.security)
  • Re: Web Authentication
    ... If your end users need to access your web app from the internet rather than ... authentication. ... > will have full control rights for a specific windows user. ... I can make the user login with a certian windows username and password then ...
    (microsoft.public.dotnet.security)