+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Custom Login control

Custom Login control

5 posts, 0 answered
  1. Carl
    Carl avatar
    7 posts
    Registered:
    17 Oct 2012
    07 Mar 2013
    Link to this post

    Looking for some assitance on a custom login control, which will provide redirection to a url based on a custom property, for now I have just set this to google to test the control,

    I have created a class inheriting from the LoginWidget

        public class Login : LoginWidget

        {
            protected override void InitializeControls(Telerik.Sitefinity.Web.UI.GenericContainer container)
            {
                base.InitializeControls(container);
                this.DestinationPageUrl = "www.google.com";
            }
        }

    I have then registered this class via the admin->settings->advanced->toolboxes->pagecontrols->sections, see attached screenshot

    I have then created a dummy page to test the control but when I preview the control I get the below error, any help would be greatly appreciated.

    Server Error in '/' Application.Unable to cast object of type 'System.Web.Compilation.BuildResultCompiledAssembly' to type 'System.Web.Util.IWebObjectFactory'.Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

    Exception Details: System.InvalidCastException: Unable to cast object of type 'System.Web.Compilation.BuildResultCompiledAssembly' to type 'System.Web.Util.IWebObjectFactory'.

    Source Error: 

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
    Stack Trace: 

    [InvalidCastException: Unable to cast object of type 'System.Web.Compilation.BuildResultCompiledAssembly' to type 'System.Web.Util.IWebObjectFactory'.]
    System.Web.UI.TemplateControl.LoadControl(VirtualPath virtualPath) +179
    Telerik.Sitefinity.Modules.Pages.ControlBuilder.CreateControl(Page page) +122
    Telerik.Sitefinity.Modules.Pages.PageHelperImplementation.CreateChildControls(IList`1 controls, Page page, Boolean ignoreCultures) +591
    Telerik.Sitefinity.Modules.Pages.DraftProxyBase.CreateChildControls(Page page) +654
    Telerik.Sitefinity.Modules.Pages.PageDraftProxy.CreateChildControls(Page page) +31
    Telerik.Sitefinity.Web.PageEditorRouteHandler.ApplyLayoutsAndControls(Page page, RequestContext requestContext) +415
    System.Web.UI.Control.LoadRecursive() +71
    System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064

  2. Atanas Valchev
    Atanas Valchev avatar
    414 posts
    Registered:
    04 Jan 2016
    12 Mar 2013
    Link to this post
    Hi,

    We have not encountered the problem before. In version 5.4 you can easily authenticate the user with SecurityManager.AuthenticateUser(); and one of the available overload. This will enable you to create an entirely custom Login Control to best fit your scenario.

    Kind regards,
    Atanas Valchev
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  3. Carl
    Carl avatar
    7 posts
    Registered:
    17 Oct 2012
    12 Mar 2013 in reply to Atanas Valchev
    Link to this post

    Can you post an example I have tried various attempts at a custom login control with no luck.

    Thanks

  4. Atanas Valchev
    Atanas Valchev avatar
    414 posts
    Registered:
    04 Jan 2016
    14 Mar 2013
    Link to this post
    Hi,

     Here is a simple custom login control example.

    Kind regards,
    Atanas Valchev
    the Telerik team
    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 Public Issue Tracking system and vote to affect the priority of the items
  5. PC
    PC avatar
    14 posts
    Registered:
    15 Apr 2013
    28 May 2013 in reply to Atanas Valchev
    Link to this post
    Thanks al, good stuff!!

    In my case, I'm try to extend the default login and add two-factor authentication for all member to login the e-commerce portal, could anyone provide the advice here? 

    Many Thanks!!! 

    Rgds,

    PC
5 posts, 0 answered