Click here to Skip to main content
12,698,179 members (22,092 online)
Rate this:
Please Sign up or sign in to vote.
See more: .NET
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------------------------------
<div class="loginControl"> <dx:ASPxLabel ID="lblUserName"
 runat="server" Text="">
 <dx:ASPxButton ID="btnLogOut"  runat="server" Text="Log Out"

-------------------the .NET.VB (code Behind)----------------
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()
        End If
    End Sub

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

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

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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

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

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170118.1 | Last Updated 9 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100