How display login name on VB ASP page?
Posted on 2011-03-01
I have written an ASP page in VB.net (VS 2010) on which I want to display the name of the user who logs in. The name needs to be in a certain place on the page.
In the Default.aspx.vb file I have the following: Public mUserName As String = User.Identity.Name
Now I want to display this public variable (mUserName) on the Default.aspx page. I have tried displaying the user's login name in an asp:label as shown below, but it errors out because "Text" attribute value is not enclosed in quotes. Here is the code:
<div style="position:absolute; top:82px; left:950px; z-index: 1; visibility:visible; height: 20px; width: 100px;">
<asp:Label ID="UserName" Text=mUserName runat="server" />
I am new to ASP. Should I be doing this another way?