Try Now
More in this section

Forums / General Discussions / Login / Register area

Login / Register area

2 posts, 0 answered
  1. Troy Lawrence
    Troy Lawrence avatar
    56 posts
    07 Jan 2010
    19 Jan 2010
    Link to this post
    I'd like to add a Login / Register area to my Sitefinity site, but I don't know how.  Ideally the user would be able to login and then it would say something like, "Welcome, Troy | Your Account | Log Out" at the top right of the screen.  Basically, I'd like it to function similarly to the Sitefinity Forums site or the Telerik site.  Are there any tutorials on this subject?  I've attached a screenshot to show what I'm looking for.

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    25 Oct 2016
    20 Jan 2010
    Link to this post
    Hello Troy Lawrence,

    You can use standard ASP.NET controls

     You should have two links (Hyperlink controls)
     Login - points to your login form - you can use LoginControl
     Register - points to your registration form - you can use CreateUserWizard control

    Once the user has been logged in you just need to create a simple control that gets the currently logged in user - UserName. You can use Sitefinity's UserManager.GetCurrentUserName() method.

    sample code

    <li id="userName" class="userName" runat="server"><asp:Label id="userLabel" runat="server" Text="<%$ Resources:UserLabel %>"></asp:Label> </li>
                            <li> | <asp:HyperLink ID="YourAccount" ToolTip="Change your settings" Text="<%$ Resources:MyPreference %>" NavigateUrl="~/Sitefinity/Admin/CmsAdmin/MyPreferences.aspx" runat="server"></asp:HyperLink></li>
                            <li> | <asp:LinkButton ID="logoutButton" CausesValidation="false" OnClick="logoutButton_Click" ToolTip="<%$ Resources:Logout %>" Text="<%$ Resources:Logout %>" runat="server"></asp:LinkButton></li>

    get username

    this.userName.Controls.Add(new LiteralControl(Telerik.Security.UserManager.GetCurrentUserName()));

    here is the logic that you should have for the logout button

    protected void logoutButton_Click(object sender, System.EventArgs e)

    All the best,
    Ivan Dimitrov
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
2 posts, 0 answered