How do I go to the current username without making it in the code, just using aspx server tags?
In encoding, I can just do this:
Label4.Text = User.Identity.Name.ToString()
But I'm trying to do it without code like this:
<body> <form id="form1" runat="server"> <div> 1. <asp:Label ID="Label1" runat="server" Text="<% User.Identity.Name %>"/><br /> 2. <asp:Label ID="Label2" runat="server" Text="<%= User.Identity.Name %>"/><br /> 3. <asp:Label ID="Label3" runat="server" Text="<%# User.Identity.Name %>"/><br /> 4. <asp:Label ID="Label4" runat="server" Text="<%= Context.User.Identity.Name %>"/><br /> 5. <asp:Label ID="Label5" runat="server" Text='<%# User.Identity.Name %>' /><br /> 6. <span runat="server" ID="Span1"><%= User.Identity.Name %></span><br /> 7. <asp:LoginName ID="LoginName1" runat="server" /><br /> 8. <span><%# User.Identity.Name %></span><br /> 9. <span><%= User.Identity.Name %></span><br /> 10. <asp:Label ID="Label6" runat="server" Text='<%= User.Identity.Name %>' /><br /> </div> </form> </body>
I get the username displayed for lines 6, 7 and 9, but I really want to set the control property for this value, and not just display it on the screen.
Is it possible?
Reference Information. I whipped up a fast application by dragging and dropping controls on a page, and it turned out that I did this with only one line in the encoding of the pages (s). This line set the value of the hidden field for the current username at page load, so I could pass the value of this control as a parameter to sqlparameter. So I thought that since I was following this route (a lot of things in aspx may not be there), I should try to be in agreement. I usually donβt do it, but I wanted this time
Keith
source share