Try Now
More in this section

Forums / General Discussions / Overwrite the LoginWidget. Set DestinationPageUrl dynamically.

Overwrite the LoginWidget. Set DestinationPageUrl dynamically.

2 posts, 0 answered
  1. Atanas
    Atanas avatar
    5 posts
    31 May 2014
    26 Jun 2014
    Link to this post

    I want to add some custom code during the login function, in particular i want to redirect the user after login to the previous page.
    For example: i'm on page A , i want to download something from this page, but i'm not authorized. Then pops a popup with link to the login page. After successful login i'm back on page A.

    For this purpose i want to overwrite the LoginWidged and to set value to"this.DestinationPageUrl" dynamically.

    I read about similar issues here  and  here, but there isn't an example how to overwrite this LoginWidget class.

    I create CustomLoginControl.cs file in my project and register as a new custom control, but after rendering it on the page, it didn't work. Login button does not make nothing. I'm not sure what exactly have to do and which of methods have to overwrite.

    namespace SitefinityWebApp.UserControls
        public class CustomLoginControl : Telerik.Sitefinity.Web.UI.PublicControls.LoginWidget
            protected override void Render(System.Web.UI.HtmlTextWriter writer)
                this.DestinationPageUrl = "http://previousPage.com";

    Can you give me an example  how to overwrite this class to work properly.

    Version: Sitefinity 5, Claims-based authentication

  2. Boyko Nistorov
    Boyko Nistorov avatar
    16 posts
    17 Oct 2016
    30 Jun 2014
    Link to this post
    Hi Atanas,

    After Sitefinity 5.3 you have all that functionality out of the box. The login widget supports ReturnUrl query parameter and returns the user to the page which was initially requested.

    Boyko Nistorov
    Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
2 posts, 0 answered