Solved

FormsIdentity & FormsAuthenticationTicket not defined in project -- please help

Posted on 2004-09-15
2
503 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

739 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