By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,065 Members | 1,598 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,065 IT Pros & Developers. It's quick & easy.

PrimaryPrincipal Security Question

P: n/a
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
Nov 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
NEVER MIND I FIGURED IT OUT

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

Nov 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.