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

Forums / General Discussions / Login Control Not Working

Login Control Not Working

9 posts, 0 answered
  1. Jonathan Perry
    Jonathan Perry avatar
    9 posts
    Registered:
    21 May 2010
    07 Jun 2010
    Link to this post
    I am having problems with the Login Control. Whenever I hit the Login button the page seems to refresh and updates the login status to logged in. However, I am wanting it to go to my home page. I have already set the destination page url it will just not go there. How can I fix this?

  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Jun 2010
    Link to this post
    Hi Jonathan Perry,

    You might experience this behavior if you have used the selector to set the page. There  is a bug that will be fixed in Sitefinity 3.7 SP4.

    The options are

    1. Set the property manually - type the url without using the selector.

    2. Expose DestinationPageUrl on the first level and use the selector

    Open  Sitefinity\UserControls\Login\LoginControl.ascx.cs and add the code below to it

    public string DestinationPage
        {
            get
            {
                return this.Login1.DestinationPageUrl;
            }
     
            set
            {
                this.Login1.DestinationPageUrl = value;
            }
        }

    When you open the designer you should see the DestinationPage property on the fist level.


    Best wishes,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. Jonathan Perry
    Jonathan Perry avatar
    9 posts
    Registered:
    21 May 2010
    07 Jun 2010
    Link to this post
    I added the code you suggest however it does the same thing. At my login page when I hit login, my login status changes to logged in. Also I know it has logged in because I have a tabstrip appear at the top of the page that can only be seen once you have been logged in.
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    07 Jun 2010
    Link to this post
    Hello Jonathan Perry,

    If you type the value manually is there any difference?

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  5. Jonathan Perry
    Jonathan Perry avatar
    9 posts
    Registered:
    21 May 2010
    07 Jun 2010
    Link to this post
    No, it does exactly the same thing.
  6. Jonathan Perry
    Jonathan Perry avatar
    9 posts
    Registered:
    21 May 2010
    07 Jun 2010
    Link to this post
    It only does this on the initial login. After I login and go to a different page and then log back out. When I log back in it takes me to the last page that I logged out off. Any more suggestions?
  7. Jonathan Perry
    Jonathan Perry avatar
    9 posts
    Registered:
    21 May 2010
    07 Jun 2010
    Link to this post
    using System;
    using System.Web.UI;
    using System.Web.UI.WebControls;
      
    public partial class UserControls_FinalLoginControls_LoginControl : UserControl
    {
        void Page_Load(object sender, EventArgs e)
        {
           
        }
      
        public Login Login
        {
            get
            {
                return this.Login1;
            }
            set
            {
                this.Login1 = value;
            }
        }
      
        public string DestinationPage
        {
            get
            {
                return this.Login1.DestinationPageUrl;
            }
      
            set
            {
                this.Login1.DestinationPageUrl = value;
            }
        }
      
      
    }
  8. Jonathan Perry
    Jonathan Perry avatar
    9 posts
    Registered:
    21 May 2010
    07 Jun 2010
    Link to this post
    <%@ Control Language="C#" AutoEventWireup="true" CodeFile="LoginControl.ascx.cs"
        Inherits="UserControls_FinalLoginControls_LoginControl" %>
    <asp:Login ID="Login1" runat="server" DestinationPageUrl="~/default.aspx">
        <LayoutTemplate>
            <h3>Login</h3>
            <fieldset>
                <ol>
                <li>
                    <asp:Label ID="UserNameLabel" runat="server" AssociatedControlID="UserName">User Name:</asp:Label>
                    <asp:TextBox ID="UserName" runat="server"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="UserNameRequired" runat="server" ControlToValidate="UserName"
                        ErrorMessage="User Name is required." ToolTip="User Name is required." ValidationGroup="ctl00$Login1">*</asp:RequiredFieldValidator>
                </li>
                <li>
                    <asp:Label ID="PasswordLabel" runat="server" AssociatedControlID="Password">Password:</asp:Label>
                    <asp:TextBox ID="Password" runat="server" TextMode="Password"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="PasswordRequired" runat="server" ControlToValidate="Password"
                        ErrorMessage="Password is required." ToolTip="Password is required." ValidationGroup="ctl00$Login1">*</asp:RequiredFieldValidator>
                </li>
                <li class="checkbox"
                    <asp:CheckBox ID="RememberMe" runat="server" Text="Remember me next time." />
                </li>
                </ol>
                <p>
                    <asp:Literal ID="FailureText" runat="server" EnableViewState="False"></asp:Literal>
                </p>               
                <p>
                    <asp:Button ID="LoginButton" runat="server" CommandName="Login" Text="Log In" ValidationGroup="ctl00$Login1" />
                </p>
            </fieldset>
        </LayoutTemplate>
    </asp:Login>
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    10 Jun 2010
    Link to this post
    Hi Jonathan Perry,

    I am not able to reproduce this issue and I will need some more details. Generally this is the standard ASP.NET Login control. The DestinationPageUrl indicates the URL to be sent after login attempt successful. You could be redirected to the last visited page if the RetunrUrl is appended to the QueryString in the url bar. The login control calls FormsAuthentication.GetReturnUrl . The method looks for current.Request.QueryString["ReturnUrl"]; If the QueryString is empty FormsAuthentication.Default url is returned. For all other cases the DestinationPageUrl value is used after you have been authenticated.

    Regards,
    Ivan Dimitrov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Register for webinar
9 posts, 0 answered