Can I turn off impersonation just in a couple instances

后端 未结 4 536
被撕碎了的回忆
被撕碎了的回忆 2020-11-27 18:53

I have an app that has impersonation used throughout. But when a user is logged in as an admin, a few operation require them to write to the server itself. Now if these us

4条回答
  •  悲&欢浪女
    2020-11-27 19:49

    You could turn off authentication for the page and then manually impersonate the authenticated user during the remainder of your code.

    http://support.microsoft.com/kb/306158

    This has a reference to that last part, but basically you impersonate User.Identity

    This will mean you will have to impersonate at the beginning of any call to the page, turn it off when you need it off, then turn it back on when you are done, but it should be a workable solution.

提交回复
热议问题