In a certain situation, I want a request to execute as a user different than the one actually logged in. So, when User A requests a particular page, from code I want to switch it execute under the user account of User B -- only for this single request (or even for a single block of code...)
I've used this:
FormsAuthentication.SetAuthCookie("UserB")
This works, but it's persistent. When I request a new page, I'm now logged in as User B, which is not what I want.
Is this possible? I've RTFM'd up and down for this.
Edit: I may have found an answer, which I posted below. Looking for confirmation or refutation of this solution.