bullrout
asked on
FormsIdentity & FormsAuthenticationTicket not defined in project -- please help
Hi There,
I am trying to use these properties ( FormsIdentity & FormsAuthenticationTicket ) in my function and I get the error saying they are not defined, I have imported all the namespaces that I thought I needed and it still does not work in my global .asx file.
Sean
Imports System.Web
Imports System.Web.SessionState
Imports System.Security.Principal
Imports System.Security
Sub Application_AuthenticateRe quest(ByVa l sender As Object, ByVal e As EventArgs)
If Not (HttpContext.Current.User Is Nothing) Then
If HttpContext.Current.User.I dentity.Is Authentica ted Then
If TypeOf HttpContext.Current.User.I dentity Is FormsIdentity Then
Dim id As FormsIdentity = CType(HttpContext.Current. User.Ident ity, FormsIdentity)
Dim ticket As FormsAuthenticationTicket = id.Ticket
Dim userData As String = ticket.UserData
Dim roles As String = userData.Split(","c)
HttpContext.Current.User = New GenericPrincipal(id, roles)
End If
End If
End If
End Sub
I am trying to use these properties ( FormsIdentity & FormsAuthenticationTicket ) in my function and I get the error saying they are not defined, I have imported all the namespaces that I thought I needed and it still does not work in my global .asx file.
Sean
Imports System.Web
Imports System.Web.SessionState
Imports System.Security.Principal
Imports System.Security
Sub Application_AuthenticateRe
If Not (HttpContext.Current.User Is Nothing) Then
If HttpContext.Current.User.I
If TypeOf HttpContext.Current.User.I
Dim id As FormsIdentity = CType(HttpContext.Current.
Dim ticket As FormsAuthenticationTicket = id.Ticket
Dim userData As String = ticket.UserData
Dim roles As String = userData.Split(","c)
HttpContext.Current.User = New GenericPrincipal(id, roles)
End If
End If
End If
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You'll need to add a reference to System.Web.dll if this is in VS.NET.