Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Basically after login with valid credentials the username is displayed on the top right corner of the page right before the logOut button but the username keep repeating itself anytime a transaction happens by the way I have the login Control in the masterPage called Root.master. Naturally code behind in Root.master.vb
how can I prevent that from repeating?
Thanks from Guy
--------------------- the .NET------------------------------
ASP.NET
 <div class="loginControl"> <dx:ASPxLabel ID="lblUserName"
 runat="server" Text="">
 <dx:ASPxButton ID="btnLogOut"  runat="server" Text="Log Out"
Border-BorderStyle="None">

-------------------the .NET.VB (code Behind)----------------
VB
Public Class Root
    Inherits System.Web.UI.MasterPage

 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Session("New") IsNot Nothing Then
            lblUserName.Text += Session("New").ToString()
        Else
            Response.Redirect("wf_Login.aspx")
        End If
    End Sub

    Protected Sub btnLogOut_Click(sender As Object, e As EventArgs)
Handles btnLogOut.Click
        Session("New") = Nothing
        Response.Redirect("wf_Login.aspx")
    End Sub
End Class


[edit]code blocks added[/edit]
Posted
Updated 9-Nov-12 11:40am
v2

1 solution

C#
lblUserName.Text += Session("New").ToString()


Just take the + off. That is concatenating to whatever is already there.
 
Share this answer
 

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