My database administrator requires that all access to the database be done through a trusted domain account. This can be done if you install web.config. This requires the user to log in or to access the domain for IE through which credentials pass. I want to impersonate the user with code. I use the code found in this knowledge base article:
http://support.microsoft.com/kb/306158
It works fine, I pass the credentials, impersonate the user, then make a call to the database and the data is returned.
The problem is that if I go to another page, I’ll lose my issued credentials. This means that every time I call the database, I have to run the issued code.
If IIS can impersonate a domain user for all pages, then why can't I impersonate a user when using code?
Something seems to be switching context flow. I tried to set alwaysFlowImpersonatingPolicy in the Aspnet.config file and this did not work.
http://msdn.microsoft.com/en-us/library/ms229553.aspx
Any suggestion? Is it possible to do what I want?
source
share