EYoung
asked on
How display login name on VB ASP page?
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" />
</div>
I am new to ASP. Should I be doing this another way?
Thank you
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" />
</div>
I am new to ASP. Should I be doing this another way?
Thank you
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for th quick answer.