c# - How do I get a .net web service call to stop impersonating to perform a task -


i have .net web service runs windows authentication , impersonation set true. when app goes connect database needs stop impersonating , run service account application pool.

my understanding has been way stop impersonation run following code.

windowsimpersonationcontext ctx = windowsidentity.impersonate(intptr.zero); 

and when want restart impersonation

ctx.undo(); 

but reason when run code never stops impersonating calling user continues user , fails connect sql db using integrated security , service account has db access.

what missing here work properly?

it seems method using fine. error problem sql connection , assumption impersonation failing. confirming assumption using wrong check verify identity. code in original question in fact work.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -