• NOW LIVE! Into the Woods--new character species, eerie monsters, and haunting villains to populate the woodlands of your D&D games.

Need ASP.NET v2.0 assistance (LoginStatus control)

rom90125

Banned
Banned
OK, I've taken the plunge and started learning ASP.NET (actually, my boss kinda forced me into it with the 'You need to get your MCTS cert by the end of the year' comment).

I've created a web site, but I can't seem to get the loginstatus control to work. Once a user is authenticated, I expected the state of the loginstatus control to update (and thus, display the 'logout' state message to the user) but it doesn't. The control still displays the 'default' state of 'login'.

Any help?

Thanks much.

ps. I catch the Authenticate event for the Login control. Otherwise, I let the Membership API automagically handle the remaining events.

Here is the code
Code:
    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        if (Membership.ValidateUser(Login1.UserName, Login1.Password))
        {
            Login1.Visible = false;
            LoginStatus1.Visible = true;
            Login1.FailureText = "";
        }
        else
        {
            Login1.FailureText = "Invalid Login Attempt!";
        }        
    }
 

log in or register to remove this ad

Start here: http://asp.net/guidedtour2/

That's, basically, a 101 lab for ASP.NET, and it's pretty good. The entire http://asp.net site has lots of resources, too. It is your friend. You might be able to get more advanced help elsewhere, but the asp.net site gives a broad range of basic stuff, including a few videos by Scott Guthrie, who is the project manager (or whatever his title is -- head dude) for ASP.NET at Microsoft.

My initial thoughts are that you may not have your IIS settings correct. Anonymous access may be on. Alternatively, if you're using Windows authentication (which is my recommendation for intranet applications), then you are most definitely already logged in.

If you're building an Internet app, then you'll need to use forms-based authentication, which involves a SQL Server (or Express) database. That's handled through the web site setup in VS2005. I'm about 90% certain that the tutorial I linked above covers it.
 

What Mercule said... and also, the web.config file needs to be properly set up to use Forms Authentication. If you are using the built in authentication for .NET you may need to create the database. Are you using visual studio (or visual web developer)?
 

Into the Woods

Remove ads

Top