Solved

FormsIdentity & FormsAuthenticationTicket not defined in project -- please help

Posted on 2004-09-15
2
490 Views
Last Modified: 2008-02-01
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_AuthenticateRequest(ByVal sender As Object, ByVal e As EventArgs)

        If Not (HttpContext.Current.User Is Nothing) Then
            If HttpContext.Current.User.Identity.IsAuthenticated Then
                If TypeOf HttpContext.Current.User.Identity Is FormsIdentity Then
                    Dim id As FormsIdentity = CType(HttpContext.Current.User.Identity, 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
0
Comment
Question by:bullrout
2 Comments
 
LVL 18

Accepted Solution

by:
DotNetLover_Baan earned 500 total points
ID: 12070482
Hi there,
Imports System.web.Security

-Baan
0
 
LVL 15

Expert Comment

by:Timbo87
ID: 12071227
You'll need to add a reference to System.Web.dll if this is in VS.NET.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

AJAX ModalPopupExtender has a required property "TargetControlID" which may seem to be very confusing to new users. It means the server control that will be extended by the ModalPopup, for instance, if when you click a button, a ModalPopup displays,…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
This video discusses moving either the default database or any database to a new volume.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now