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

android - net_scheduler holding wakelock -

sql - MySQL : Getting Entries from a many-to-many table -

java - Retrieving data from database using jsp (Hibernate + Spring + Maven) -