Forums

Skip Navigation LinksHome / Developer Network / Forums / Sitefinity Older Versions (3.x): Security > Cannot login

Cannot login

  • Posted on Nov 26, 2010 (permalink)

    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

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Nov 26, 2010 (permalink)

    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

    Reply

  • Posted on Nov 26, 2010 (permalink)

    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

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Nov 26, 2010 (permalink)

    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

    Reply

  • Posted on Nov 26, 2010 (permalink)

    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>

    Reply

  • Posted on Dec 1, 2010 (permalink)

    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

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Dec 1, 2010 (permalink)

    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

    Reply

  • Posted on Dec 2, 2010 (permalink)

    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

    Reply

  • Ivan Dimitrov Ivan Dimitrov admin's avatar

    Posted on Dec 2, 2010 (permalink)

    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

    Reply

  • Posted on Dec 2, 2010 (permalink)

    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

    Reply

  • Joseph avatar

    Posted on Dec 15, 2010 (permalink)

    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");
                }
                
            }
        }
    }

    Reply

  • Register for webinar
Skip Navigation LinksHome / Developer Network / Forums / Sitefinity Older Versions (3.x): Security > Cannot login