Hi all:
Please I need help one more time.
I needed to make some changes and additions to my Identity class and I thought everything was ok.
I need to add 2 properties to the identity and those properties will be set by the UI during login process. So I changed from ReadOnlyBase to BussinessBase class. Also I added some readonly properties.
Following are some details of my Identity class, in italics my additions or changes:
Imports System.Security.Principal
Namespace Security
<Serializable()> _
Public Class GTIdentity
Inherits BusinessBase(Of GTIdentity)
Implements IIdentity
#Region " Bussines Methods "
Protected Overrides Function GetIdValue() As Object
Return _name
End Function
Private _id As Guid = Guid.Empty
Public ReadOnly Property Id() As Guid
Get
Return _id
End Get
End Property
Private _lastname As String = ""
Public ReadOnly Property Lastname() As String
Get
Return _lastname
End Get
End Property
Private Shared pIdOffice As PropertyInfo(Of Guid) = RegisterProperty(New PropertyInfo(Of Guid)("IdOffice", My.Resources.GTIdentity.pOfficeName))
'some code here to declare GET&SET
#Region " IsInRole "
Private _roles As New List(Of String)
Friend Function IsInRole (ByVal role As String) As Boolean
Return _roles.Contains(role)
End Function
Public Sub LoadRoles()
'some code here because I load the roles and fill the role list after knowing in which office the user is going to log in.
For Each p In roles
_roles.Add(p.perm_Codi)
Next
End Sub
#End Region
' Office list to provide the UI developer
Private Structure OfficeDetails
Dim _id As Guid
Dim _name As String
End Structure
Private _Offices As New List(Of OfficeDetails)
#End Region
#Region " Data access "
Private Sub Fetch(ByVal user As IMultipleResults)
'here I fetch the user details and his list of office he can log in. This is a sub wich is called from both DataPortal_Fetch methods.
End Sub
#End Region
End Class
End Namespace
My Principal class has no changes and when I tried to run VS threw a TypeInitializationException of type 'GT.Library.Security.GTIdentity' was unhandled by the user. It was in the Principal.Logout, exactly in this line:
Dim identity As GTIdentity = GTIdentity.UnauthenticatedIdentity()
Could somebody explain that to me?
Thanks in advance,
Lazaro Manuel
Hi all:
I have some news about this problem. I got into the error window and took a look to error message and it said something about the resources and culture.
Know what? I was using a resx file in the Identity class, in that file I had just text. I removed the reference to theese texts and the problem went away.
Does anybody know why those references to the resources caused that unhandled exception?
Which make the Identity class different from the others?
Thanks,
Lazaro Manuel
Copyright (c) Marimer LLC