Ask a Question related to ASP.NET Security, Design and Development.
-
Mike Viglianco #1
Re: Custom Authentication Ticket
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
[url]http://www.dotnetcoders.com/web/Articles/ShowArticle.aspx?article=41[/url] 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 [url]http://www.developersdex.com[/url] ***
Don't just participate in USENET...get rewarded for it!
Mike Viglianco Guest
-
Form Authentication Ticket
I've read some books and online articles on how to implement form authentication. Some taught me just to do... -
Forms Authentication Ticket Reissue
When using Forms Authentication with the SlidingExpiration attribute set to 'true', the authentication ticket is reissued sometime after half of... -
Encryption of Authentication Ticket
i have a question regarding the encryption of an Authentication Ticket under FormsAuthentication. Can anyone tell me what type of encryption is used... -
Why authentication Ticket expires
Can anybody tells if I'm doing something wrong in this code and why the user authentication ticket always expires 30 minutes later, even though I... -
Authentication ticket, cookieless, forms authentication?
Hi. I want to use Forms Authentication, cookieless. The issue is setting the Authentication Ticket without using cookies (!) That is, the...



Reply With Quote

