Overwrite the LoginWidget. Set DestinationPageUrl dynamicall

Posted by Community Admin on 03-Aug-2018 16:24

Overwrite the LoginWidget. Set DestinationPageUrl dynamically.

All Replies

Posted by Community Admin on 26-Jun-2014 00:00

Hi,
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";
            
            base.Render(writer);
        
    

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

Version: Sitefinity 5, Claims-based authentication

Posted by Community Admin on 30-Jun-2014 00:00

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.

Regards,
Boyko Nistorov
Telerik

 
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
 

This thread is closed