• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Run program as different user VB?

Smoblikat

Diamond Member
Hello,

I am trying to code a button to launch IE to a specific website, but I want to launch IE as a different user than the current one. The reason I want to do this is because the site that I am going to link to can only be fully used if it is logged into by a domain admin account. How would I go about launching IE as a different user (prompt the user to enter credentials, but DO NOT cache them with my program) then after they logged in, re-direct them to the correct page?

Thanks!
 
Something along this will do

Code:
Dim myprocess As New ProcessStartInfo(My.Computer.FileSystem.SpecialDirectories.ProgramFiles + "\Internet Explorer\IEXPLORE.EXE")
myprocess.UseShellExecute = False
myprocess.Domain = "[I]Domain[/I]"
myprocess.UserName = "[I]Username[/I]"
myprocess.Password = New System.Security.SecureString()
For Each cpass As Char In "[I]Password[/I]"
      myprocess.Password.AppendChar(cpass)
Next
myprocess.Arguments = ("http://www.anandtech.com")
Process.Start(myprocess )
 
Something along this will do

Code:
Dim myprocess As New ProcessStartInfo(My.Computer.FileSystem.SpecialDirectories.ProgramFiles + "\Internet Explorer\IEXPLORE.EXE")
myprocess.UseShellExecute = False
myprocess.Domain = "[I]Domain[/I]"
myprocess.UserName = "[I]Username[/I]"
myprocess.Password = New System.Security.SecureString()
For Each cpass As Char In "[I]Password[/I]"
      myprocess.Password.AppendChar(cpass)
Next
myprocess.Arguments = ("http://www.anandtech.com")
Process.Start(myprocess )

Excellent, thank you. Will this program prompt people to enter their windows credentials in the normal windows dialog box, or will I need to substiture the "username", "domain" etc.. with a username and domain? Everyone has different accounts, so if its the latter im not sure if this will work.

Thank you.
 
Excellent, thank you. Will this program prompt people to enter their windows credentials in the normal windows dialog box, or will I need to substiture the "username", "domain" etc.. with a username and domain? Everyone has different accounts, so if its the latter im not sure if this will work.

Thank you.

Just create a simple user form and prompt the use for values.It was for reference purpose.
 
Are there other sites you don't want them to access with those rights? If they navigate away, the window will retain the domain admin credentials. This includes accessing things like c:\windows or \\someOtherDudesPC.
 
Back
Top