Re: Custom Authentication Ticket

Posted: 07-08-2003, 04:18 PM
James, I found your C code and tutorial about this. I attempted to
convert it to VB as follows but could you possibly tell me why the code
segment 'ActiveUserInfoSerializer.Deserialize' gives the error
"Reference to non-shared member requires an object reference"? Is there
a difference between C and VB that accounts for this? In your article
http://www.dotnetcoders.com/web/Arti...spx?article=41 You
describe 3 classes. Should they be in three separate class files or
what? I have been away from OO programming for a few years and it isn't
natural to me currently. Thanks.

Public Class ActiveUserInfo

Dim UserID As Integer
Dim Username As String
Dim UserType As String

End Class

Imports System
Imports System.IO
Imports System.Xml.Serialization
Imports System.Web


Public Class ActiveUserInfoSerializer

Public Function Serialize(ByVal objData As ActiveUserInfo) As String

Dim sw As StringWriter = New StringWriter()
Dim serializer As XmlSerializer = New XmlSerializer(objData.GetType())

serializer.Serialize(sw, objData)
sw.Close()
Serialize = sw.ToString()

End Function

Public Function Deserialize(ByVal strXML As String) As ActiveUserInfo

Dim type1 As ActiveUserInfo
Dim sr As StringReader = New StringReader(strXML)
Dim serializer As XmlSerializer = New XmlSerializer(type1.GetType)
Dim objDeserializedObject As ActiveUserInfo =
CType(serializer.Deserialize(sr), ActiveUserInfo)

Deserialize = objDeserializedObject

End Function

End Class

Public Class ActiveUser

Public ReadOnly Property UserID() As Integer
Get
Dim objActiveUser As ActiveUser =
ActiveUserInfoSerializer.Deserialize(HttpContext.C urrent.User.Identity.N
ame)
UserID = objActiveUser.UserID
End Get
End Property

Public ReadOnly Property UserName() As String
Get
Dim objActiveUser As ActiveUser =
ActiveUserInfoSerializer.Deserialize(HttpContext.C urrent.User.Identity.N
ame)
UserName = objActiveUser.UserName
End Get
End Property

Public ReadOnly Property UserType() As String
Get
Dim objActiveUser As ActiveUser =
ActiveUserInfoSerializer.Deserialize(HttpContext.C urrent.User.Identity.N
ame)
UserType = objActiveUser.UserType
End Get
End Property

End Class




*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply With Quote

Responses to "Re: Custom Authentication Ticket"

 
LinkBack Thread Tools Search this Thread Display Modes
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
WebService custom authentication BillHeit Macromedia Flex General Discussion 2 03-08-2005 01:42 AM
Authentication Issue Stephen PHP Development 5 10-14-2003 01:52 AM
Golden Ticket sirlenoir Adobe Photoshop 7, CS, CS2 & CS3 4 06-27-2003 06:23 PM
php scripts for email authentication Xerxes PHP Development 2 06-27-2003 04:16 AM
how to avoid authentication Konrad ASP.NET General 1 06-25-2003 11:51 PM