Mixing Windows Authentication with Forms Authentication

后端 未结 3 2208
梦毁少年i
梦毁少年i 2020-12-20 17:54

Consider a site used for an intranet which should also be accessible from the internet. On the intranet you want to use Windows Authentication and on the internet you want t

3条回答
  •  误落风尘
    2020-12-20 18:43

    I know of no build-in way of doing this. But you can use a simple workaround:

    Choose forms authentication as your primary authentication and map windows authentication to it. You can do so in the applications AuthenticateRequest using global.asax or a special http handler or module. Identify your intranet user in this request and set the forms authentication cookie using FormsAuthentication.SetAuthCookie programmatically.

    I actually use this for a mixed mode forms and IP-Number authentication, but I think it would work for forms and windows auth too.

    By the way: Maybe mixed mode forms and IP-Number authentication is a second solution for your problem. If your server is part of a DMZ you can detect your Intranet user by the IP number subnet.

提交回复
热议问题