views:

34

answers:

0

Hi,

I am using ASP.NET 3.5 with Visual Studio 2008. I am a new bee in ASP.NET and working on a website where it can have 3 types of member visiting to it like admin, registered users and annonymous users. I want to provide authentication and session management for these users.

I am not using Login Control provided MS/.NET rather created my own. Below is the code I am using.:

// Check authentication. Guid returned should not be same as 0000-0000-0000-0000 string token = authenticator.AuthenticateUser(UserName.Text, Password.Text); // This //method uses Membership class to validate user. On successful validation, it returns //FormsAuthenticationTicket to UI.

        if ((token == null) || (token.Length == 0))
        {
            // show error
        }
        else
        {
            // Authentication succeed
            // save token to session.               
            Session[CommonConstants.Ticket] = token;                
            FormsAuthentication.RedirectFromLoginPage(UserName.Text, false);                
        }

This redirect me to my previously requested page that is Default.aspx page. In this page I found property like User well populated with user name and IsAuthenticated = true. So far so good.

Now from Here i try navigate to second page called ReportList.aspx which now shows this.User.Identity.IsAuthenticated = false and Name = "";

Why this happened? Am I missing something? Is there better authentication and Session/State management tools/class libraries in .NET? Please help me..

Thanks in advance!