Link to home
Start Free TrialLog in
Avatar of CaptainRantflaps
CaptainRantflaps

asked on

Running a function as a specific user account.

I suspect the answer to this problem is no, however here it is.

Is there any way to run a specific function of code under a specified user account? I have an asp application (intranet) that uses the Integrated security method. ie if MyDomain\UserA is the owner of the browser, then MyDomain\UserA is the account that runs the code.

I have a page that need to use the current user for most of the code, however one function on that page needs to use a specific user account to get the job done.  I need to know how to run the page under integrated security, and yet run the one function as Mydomain\Superuser.

A web config file in folder wont do it, as it changes the security method for the entire page. So I am looking for a line(s) of code that can be contained within my function to swap the user

I need something like:-

CurrentUser.Name="MyDomain\Superuser"
Currentuser.Password="abc12345"

{execute code that needs new security access}

CurrentUser.Name= {Integrated user etc}

{rest of code that needs current user permissions now runs}
Can this be done?
ASKER CERTIFIED SOLUTION
Avatar of ihenry
ihenry

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial