Change User in winforms application during run-time

L

landesjoe

Hi,
Here's the problem:
We have an app that we open by default for the user logged into the
Windows box on a Windows Domain (using active directory). Let's say
that's "Hans".
That works great, the .NET app uses that user's identity in the
Tread.Prinicipal object all through the system, including logging into
a SQL2K db where the tables and stored procs use the Windows Account
for authorization regarding execute permissions.
Now there are times where we need to log in as another user, i.e. an IS
person that has much higher permission level. That person's going to be
"Mike". Besides changing the layout of some navigation forms, we also
need to update that context change on the Database access tools such
that the DB now knows that the "NTUserName" is Mike, not Hans anymore.

I have played around with a bunch of MS suggestions regarding
"LogonUser" API call. Every time it comes back with error 1314 (generic
users do not have permission to change User). We can't give our users
that kind of permission.
So, is there another way to do this during run-time, or do I need to
set the principle user before I launch the app to avoid this problem?

Thanks a lot,
Joachim Landes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top