I am developing windows desktop application in vb.net which is installed on Windows 7.
I am not going to use any internet service for this, it will be stand-alone application for desktop with 2 users, Admin and Regular user.
The application will install on the regular users account, regular user can not access restricted file location but this application should able to read these files, as I have passed admins credentials to it.
I have installed this app on user's (Regular Users Account which dont have admin rights.) account.
I have given the credentials of admin in code, so my app can access the file using admin credentials but its giving an error - Access is Denied.
Try
Dim ssPwd As New System.Security.SecureString
Dim s As String = "4321"
For i = 0 To s.Length - 1
ssPwd.AppendChar(s(i))
Next
Dim pro As New ProcessStartInfo
pro.UserName = "Admin"
pro.FileName = "C:\Windows\Myapp\app1.exe"
pro.Password = ssPwd
pro.UseShellExecute = False
Process.Start(pro)
Catch ex As Exception
MessageBox.Show(ex.Message.ToString, "Error in accessing app.", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
What I am missing ? What should I do ?