C# .NET - How to clear a text for a loginstatus control

Asked By Daniel
19-Oct-11 02:58 AM
Hi!I am trying  to clear a text of a label,I have a label and a [loginstatus] control on my form but when a session is logged out It still keep a  text of a label.how can I clear it once is logged out?I am using the following code to perfom that:
 protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["Mynumtel"] != null)
            {
                LabelAgentName.Text = GetAgentFunction(Session["Mynumtel"].ToString());
                LoginStatusA.LoginText = "Log out";
              
            }
            else
            {  
                LabelAgentName.Text = String.Empty;
                LoginStatusA.LoginText = "Log in";
            }
        }
Can someone tell me what is wrong...
  smr replied to Daniel
19-Oct-11 03:07 AM
hi

add this in your condition
LoginStatusA.LoginText.visible=false;

(or)

LoginStatusA.visible=false;
  dipa ahuja replied to Daniel
19-Oct-11 03:26 AM
If you are using the Login status control You don't need to do this manually and because we use the Login control with it you can set the property directly in the markup page:

Take the Login View control and put the login Status inside it:

<%--<b>Login View</b>--%>
<asp:LoginView ID="LoginView3" runat="server">
<LoggedInTemplate>
    <asp:LinkButton ID="LinkButton3" runat="server" Text="My Profile" PostBackUrl="#" /><br />
    <asp:LoginStatus LogoutText="Sign Out" ID="LoginStatus" runat="server" />    
</LoggedInTemplate>        
<AnonymousTemplate>
<asp:LinkButton ID="lnk" runat="server" Text="Login" PostBackUrl="Login.aspx" /><br />
</AnonymousTemplate>
</asp:LoginView>
Create New Account
help
FormsAuthentication Cookie becomes null in Redirected page FormsAuthentication Cookie becomes null in Redirected page It is having the values in Login Page. Login page code: if (Membership.ValidateUser(Login1.UserName , Login1.Password )) { FormsAuthenticationTicket ticket = new FormsAuthenticationTicket( 2, Login1.UserName cookie); Response.Redirect(http: / / localhost / famt / default.aspx); } Default.aspx: protected void Page_Load(object sender, EventArgs e) { FormsAuthenticationTicket returnValue = default(FormsAuthenticationTicket); string cookieName = FormsAuthentication.FormsCookieName.ToString(); returnValue = FormsAuthentication.Decrypt(Request.Cookies
how to create login page using asp.net 2.0 C# hi frndz, I'm doing a project in asp.net 2.0 c#. In this project I wanted to create login page. In that login page it consists of username, password and email id. The client want to enter username, password me coding for this project. Please help me its very urgent. Here is a sample login form. protected void Button1_Click( object sender, EventArgs e) { SqlConnection lgnConnection = new SqlConnection(); lgnConnection.ConnectionString = "YourConnectionString" ; lgnConnection.Open(); SqlCommand cmd = new SqlCommand( "SELECT
session login and logout as the default login page in asp.net 4.0 Hi!I want to get a page like the default login page in asp.net 4.0. or same thing like in yahoo I have a table Username password 123 788888 Admin admin123 124 783838 Daniel dan123 I have 4 pages (master page, Home page, login page and Menupage) on my home page I have something like this after start
how to create custom login page for sharepoint 2007 i want to create a extranet site with FBA. i want to use my custom login page and forgot password page. how to create those page and how to add those page in my fba application. steps for how to create fba for sharepoint 2007 other wise any link http: / / blogs.msdn.com / b / kaevans / archive / 2010 / 07 / 09 / creating-a-custom-login-page-for-sharepoint-2010.aspx It describes how to create your own login page that
logout hi, in my asp web page, in the default3.aspx[home page] page , i have placed one [logout ] hyperlink control , and i set the property for navigate url as default2.aspx[login page] if i click on hyperlink[logout], then it is directed to default2.aspx which is my login page and everything is working fine but after debugging, if i click on logout , it is navigating to login page, and if i click on back button ( <- - ), which is at the top left of