Programmatically enable or disable anonymous authentication in IIS

前端 未结 2 391
梦如初夏
梦如初夏 2021-01-20 05:23

I have a web application and I need to provide its users the option to switch login method from FormsAuth to WindowsAuth. I managed to change the web.config file via code:

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-20 05:35

    Okay, so, turned out I could not find a way to dynamically change the auth mode, but I found pretty neat solution to the problem: I have created another web application, nested it inside the first one, had set Forms Auth mode for the first one and Windows for the nested and whenever I needed to use IIS's power to work with domain, user groups etc, I used a redirect from one to another, passing data by cookies and as url parameters.

提交回复
热议问题