Can I use a attribute to make .net impersonate another user?

Posted by Rising Star on Stack Overflow See other posts from Stack Overflow or by Rising Star
Published on 2010-06-08T18:47:07Z Indexed on 2010/06/08 18:52 UTC
Read the original article Hit count: 143

Filed under:
|
|

I am familiar with impersonating an account in .net by using:

dim myIdentity as WindowsIdentity = someIdentity
using ctx as WindowsImpersonationContext = myIdentity.Impersonate()
doStuff()
end using

Is it possible to define a .net attribute so that I could write something like:

< runAsUser(someIdentity) > public sub doStuff()

and then have the .net framework always impersonate when running the method doStuff()?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about attributes