Click here to Skip to main content
15,037,388 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi

I have a Placed Login_view control in master page and Login control in login page. How can I make LoggedInTemplate of Login_view control visible on valid login with username, which is used to login.

Note: For any clarification, please revert back

Thanks in advance,
Deepak
Posted
Updated 22-Mar-12 13:09pm
v3

1 solution

you will have to do something like this in your master page

C#
if (Session["UserName"] == null)
        {
            lblWelcome.Visible = false;
        }
        else
        {
            lblWelcome.Text = "Welcome: " + Session["UserName"].ToString();
            lblWelcome.Visible = true;
        }



and populate the session variable on successful login

C#
if (userHandler.ValidateUser(username, password))
        {
            Session["UserId"] = username;
            Session["UserName"] = userHandler.GetUserName(username);
            Response.Redirect("Default.aspx");
        }
   
Comments
deepak2prince 30-Mar-12 1:34am
   
This enables to change text of label, but i need to show <loggedin> template of login view on valid login to user.

Please do help me on this.

Thanks
Deepak M R

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900