views:

130

answers:

2

Hello all,

I intend to use membership.authentication/authorization API from ASP.NET 2.0 in in ASP.NET 3.5 web app. However, when I implement the LoggedIn method for a login component as below:

protected void Login1_LoggedIn(object sender, EventArgs e)
    {
        Label1.Text = User.Identity.Name;
    }

the Name comes as a null value... the username/pass are correct, the login control works fine if the default behavior is used, but it seems that the Identity is not properly initialized. Any ideas on how to get the current User object with the associated values?

Thanks

A: 

You may need to check User.IsAuthenticated is true first

static
It is false; I find it counterintuitive, as the loggedin evednt raises - hence the user/pass is recognized by the system...
lmsasu
This should indicate that the login and password are incorrect.
JoshJordan
A: 

You can use Membership.GetUser method to accomplish the same thing:

Label1.Text = Membership.GetUser().UserName
Darin Dimitrov
Membership.GetUser() return null.
lmsasu