How to use Windows Authentication in WPF?

后端 未结 2 2063
迷失自我
迷失自我 2021-02-01 10:54

I\'m not finding much documentation on how to use Windows Authentication in a WPF app. I wouldn\'t have thought that it would be any different than in any non-WPF app, but it s

2条回答
  •  天命终不由人
    2021-02-01 11:25

    Itowlson's answer is correct, but also, in order to use the PrincipalPermissionAttribute on any method, you have to first make the windows principal the current principal by calling:

    AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)
    

提交回复
热议问题