用户名在登录后继续在每个事件上重复 [英] UserName keep repeating itself on every event after login

查看:77
本文介绍了用户名在登录后继续在每个事件上重复的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,使用有效的凭据登录后,用户名显示在页面的右上角,就在注销按钮之前,但是只要发生交易,只要我在名为Root的母版页中拥有登录控件,用户名就会不断重复.掌握.自然地在Root.master.vb中编写代码
如何防止重复出现?
来自盖伊的感谢
- - - - - - - - - - - 互联网 - - - - - - - - - - - - - ----

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"

Border-BorderStyle="None">


-------------------.NET.VB(后置代码)----------------


-------------------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()
        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]添加了代码块[/edit]



[edit]code blocks added[/edit]

推荐答案

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



只需将+取下即可.那就是连接已经存在的任何东西.



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


这篇关于用户名在登录后继续在每个事件上重复的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆