Id like to know how to display a logged in users name on a aspx webpage?

The website is a music online store that can be view without logging into the site. If the user however wants to purchase a music album and they are not registerd to my site, then the have to register to our site. Then there after once they login to the site, it must display the users name on each page once the have logged in.
Thanks guys

Recommended Answers

All 2 Replies

                <asp:LoginView ID="HeadLoginView" runat="server" EnableViewState="false">
                        [ <a href="~/Login.aspx" ID="HeadLoginStatus" runat="server">Log In</a> ]
                        Welcome <span class="bold"><asp:LoginName ID="HeadLoginName" runat="server" /></span>!
                        [ <asp:LoginStatus ID="HeadLoginStatus" runat="server" LogoutAction="Redirect" LogoutText="Log Out" LogoutPageUrl="~/"/> ]


If you use visual studio, just create a new web app project. In the project, you'll find that it creates a sample web application that includes all of the login examples. The code that vsmash provided looks like it came from that example web application.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.