Set 'RunAs' property programmatically for WinForms VB.Net applicat

G

Guest

Hi,

in a .Net 1.1 WinForms application I have a dialog that lets the user set
new network credentials.

Question: How can I assign the new credentials - say nc, defined by

Dim nc = New System.Net.NetworkCredential(M_User, M_Password, M_Domain)

- to the running (VB.Net -) application, so that the application behaves
like being started in 'RunAs' dialog?

Thanks for help in advance!
 
K

Kevin Yu [MSFT]

Hi Henry,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to impersonate a windows form
application. If there is any misunderstanding, please feel free to let me
know.

Based on my research, we can use WindowsIdentity.Impersontate method to
achieve this. This method allows code to impersonate a different Windows
user. Here is a link for more information on this method with a good sample.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfsystemsecurityprincipalwindowsidentityclassimpersonatetopic.asp

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

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

Top