Is there a simple out of the box way to impersonate a user in .NET?
So far I've been using this class from code project for all my impersonation requirements.
Is there a better way to do it by using .NET Framework?
I have a user credential set, (username, password, domain name) which represents the identity I need to impersonate.
Here is some good overview of .NET impersonation concepts.
Basically you will be leveraging these classes that are out of the box in the .NET framework:
The code can often get lengthy though and that is why you see many examples like the one you reference that try to simplify the process.