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

Forums / Security / Cannot login

Cannot login

11 posts, 0 answered
  1. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    26 Nov 2010
    Link to this post
    Hi,

    I've been working on a local site for about 3 weeks, no problems. Last night, I closed down my Virtual Machine as normal.

    Today, I cannot access the Sitefinity admin part at all, even if i create a new administrator using the ASP.NET Website Configuration tool. I only get the error message "Your login attempt was not successful. Please try again."

    I don't know what to do - I can't access the admin at all!

    Thanks in advance
    higgsy
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    26 Nov 2010
    Link to this post
    Hello higgsy,

    If you use the correct username and password, make sure that you use the correct membership and role providers and database.

    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
  3. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    26 Nov 2010
    Link to this post
    Ivan,

    There is a member login control on the public side of the website. If i login there using my admin details, i can then navigate back to /sitefinity/ and gain access to the admin section - however if i manually try to login through the sitefinity login interface it rejects my details.

    The role manager and membership provider havent changed at all from installation.

    <roleManager enabled="true" cacheRolesInCookie="true" defaultProvider="Sitefinity">
                <providers>
                    <clear/>
                    <add connectionStringName="DefaultConnection" applicationName="/" name="Sitefinity" type="Telerik.DataAccess.AspnetProviders.TelerikRoleProvider, Telerik.DataAccess"/>
                </providers>
            </roleManager>
            <membership defaultProvider="Sitefinity" userIsOnlineTimeWindow="15" hashAlgorithmType="">
                <providers>
                    <clear/>
                    <add name="Sitefinity" connectionStringName="DefaultConnection" type="Telerik.DataAccess.AspnetProviders.TelerikMembershipProvider, Telerik.DataAccess" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" applicationName="/" requiresUniqueEmail="true" passwordFormat="Hashed" maxInvalidPasswordAttempts="5" passwordAttemptWindow="10" passwordStrengthRegularExpression="" minRequiredPasswordLength="1" minRequiredNonalphanumericCharacters="0"/>
                </providers>
            </membership>

    higgsy
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    26 Nov 2010
    Link to this post
    Hi higgsy,

    Check whether the cmsProvidersName in <security> node is Sitefinity. You can debug the code in Sitefinity/Login.aspx.cs in Login1_Authenticate and Login1_LoggedIn to see the provided that is used to authenticate your user.

    Greetings,
    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. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    26 Nov 2010
    Link to this post
    Yes it is, again that hasn't changed at all:

    <security defaultProvider="DefaultSecurityProvider" cmsProvidersName="Sitefinity">
                <roles>
                    <clear/>
                    <add name="Administrators" permission="Unrestricted"/>
                </roles>
                <providers>
                    <clear/>
                    <add name="DefaultSecurityProvider" connectionStringName="DefaultConnection" type="Telerik.Security.Data.DefaultSecurityProvider, Telerik.Security.Data" membershipProvider="Sitefinity" roleProvider="Sitefinity"/>
                </providers>
            </security>

  6. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    01 Dec 2010
    Link to this post
    Hi Ivan,

    I have debugged the code for /sitefinity/login.aspx and think I have found the problem.

    The provider is definitely "Sitefinity", however when I debug the following line:

    e.Authenticated = UserManager.Default.ValidateUser(this.Login1.UserName, this.Login1.Password);

    this.Login1.Username and this.Login1.Password are both empty strings.

    How can that possibly be?

    I'd appreciate your input.

    Thanks
    higgsy
  7. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    01 Dec 2010
    Link to this post
    Hello higgsy,

    Make sure that forms authentication is enabled. This article may also help - Taking Advantage of the Integrated Pipeline  if you are running IIS. There is some configuration problem with your server. Compare the web.config files between staging and production.

    If you run the website though Visual Studio web server, does the problem persists? We use the standard ASP.NET Login control that comes from the framework.

    Greetings,
    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
  8. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    02 Dec 2010
    Link to this post
    Hi Ivan,

    Thanks for your response. I dont think there is a problem with the config, because if I manually set the account details like so:

    e.Authenticated = UserManager.Default.ValidateUser("admin", "password");

    I can login successfully, it is only when using the default code:

    e.Authenticated = UserManager.Default.ValidateUser(this.Login1.UserName, this.Login1.Password);

    I cannot login.

    Regards,
    higgsy
  9. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    09 Dec 2016
    02 Dec 2010
    Link to this post
    Hi higgsy,

    If you run the website though Visual Studio web server, does the problem persists?

    Kind 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
  10. higgsy
    higgsy avatar
    336 posts
    Registered:
    05 Aug 2010
    02 Dec 2010
    Link to this post
    Hi Ivan,

    I've got it working, but I had to manually get a handle on the Username and Password text boxes, rather than getting it via Login1.Username and Login1.Password

    e.Authenticated = UserManager.Default.ValidateUser(((TextBox)Login1.FindControl("UserName")).Text, ((TextBox)Login1.FindControl("Password")).Text);

    I have added a Login control to the toolbox, which is when the problems started happening - there is a definite bug somewhere,

    Thanks for your help.
    higgsy
  11. Joseph
    Joseph avatar
    11 posts
    Registered:
    03 Aug 2010
    15 Dec 2010
    Link to this post
    Hi,

    Here is a working login control:

    CustomLogin.ascx:

    <asp:Login ID="Login1" runat="server" onauthenticate="Login1_Authenticate">
        <LayoutTemplate>
                        <table>
                           <%-- <tr>
                                <td colspan="2" align="center">
                                    Login
                                </td>
                            </tr>--%>
                           <%-- <tr>
                                <td colspan="2" align="center">
                                    Enter your user name and password to log in.
                                </td>
                            </tr>--%>
                            <tr>
                                <td>
                                    <table>
                                        <tr>
                                            <td>
                                                User name:
                                            </td>
                                            <td>
                                                <asp:TextBox id="UserName" runat="server"></asp:TextBox>
                                                <asp:requiredfieldvalidator id="UserNameRequired" runat="server" ControlToValidate="UserName" Text="*"></asp:requiredfieldvalidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td>Password:</td>
                                            <td>
                                                <asp:TextBox id="Password" runat="server" textMode="Password"></asp:TextBox>
                                                <asp:requiredfieldvalidator id="PasswordRequired" runat="server" ControlToValidate="Password" Text="*"></asp:requiredfieldvalidator>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td colspan="2">
                                                <asp:Checkbox id="RememberMe" runat="server" Text="Remember my login"></asp:Checkbox>
                                            </td>
                                        </tr>
                                    </table>
                                </td>
                                <td valign="middle">
                                  <%--  <ul>
                                        <li><a href="newAccount.aspx">Create a new account...</a></li>
                                        <li><a href="getPass.aspx">Forgot your password?</a></li>
                                        <li><a href="help.aspx">Get help logging in...</a></li>
                                    </ul>--%>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2">
                                    <asp:button id="Login" CommandName="Login" runat="server" Text="Login"></asp:button>
                                </td>
                            </tr>
                            <tr>
                                <td colspan="2" align="center">
                                    <asp:Literal id="FailureText" runat="server"></asp:Literal></td>
                            </tr>
                        </table>
                       </LayoutTemplate>
    </asp:Login>

    CustomLogin.ascx.cs:

    using System;
    using System.Web.UI.WebControls;
    using Telerik.Sitefinity.Security;
     
    namespace SitefinityWebApp.UserControls.Login
    {
        public partial class CustomLogin : System.Web.UI.UserControl
        {
            protected void Page_Load(object sender, EventArgs e)
            {
     
            }
     
            protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
            {
                UserManager manager = UserManager.GetManager();
     
                e.Authenticated = manager.ValidateUser(((TextBox)Login1.FindControl("UserName")).Text, ((TextBox)Login1.FindControl("Password")).Text);
     
                if (e.Authenticated)
                {
                    Response.Redirect("~/home");
                }
                
            }
        }
    }
Register for webinar
11 posts, 0 answered