P
Paul
I was working with a VB book that was going over the Security stuff in
VBNet, and I can't seem to get their code to work. I modified it and
I can't seem to get it to work either. I am running windows XP at
home(not on a network). My username is "Paul" and I am part of
Administrators group. (I tripled checked)Here is the code. Thanks in
advance for the help.
Imports System.Security, System.Security.Principal,
System.Security.Permissions
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
System.AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
Dim pp1 As New
PrincipalPermission("Paul","BUILTIN\Administrators")
'ALWAYS GETTING 'Request for Principal Permission failed"
'Have tried for Role :
'Administrators","Administrator", "XPCOMPUTER\Administrator"....
'all combinations
Try
pp1.Demand()
Catch se As SecurityException
MessageBox.Show(se.ToString)
End Try
End Sub
End Class
VBNet, and I can't seem to get their code to work. I modified it and
I can't seem to get it to work either. I am running windows XP at
home(not on a network). My username is "Paul" and I am part of
Administrators group. (I tripled checked)Here is the code. Thanks in
advance for the help.
Imports System.Security, System.Security.Principal,
System.Security.Permissions
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
System.AppDomain.CurrentDomain.SetPrincipalPolicy(PrincipalPolicy.WindowsPrincipal)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button3.Click
Dim pp1 As New
PrincipalPermission("Paul","BUILTIN\Administrators")
'ALWAYS GETTING 'Request for Principal Permission failed"
'Have tried for Role :
'Administrators","Administrator", "XPCOMPUTER\Administrator"....
'all combinations
Try
pp1.Demand()
Catch se As SecurityException
MessageBox.Show(se.ToString)
End Try
End Sub
End Class