Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Max Öhman 42 posts 71 karma points
    Dec 16, 2010 @ 15:57
    Max Öhman
    0

    Implementing membership ASP.NET control, Umbraco 4.5

    Hi everybody!

    I'm trying to get a simple membership login control to work on my site. I have created member types and set the correct public access. As far as I know this is the only code I really should need to add: <asp:Login ID="Login1" runat="server"></asp:Login>. Now when I try to login I don't get any indication that the control works. I've read post after post about different changes you can do to the web.config file, but nothing of this have helped me. There are a lot of solutions that seems to be working for umbraco 4.0. Is it possible there are differences between 4.5 and 4.0? Have anyone got the asp control to work?

    Thank you for reading this and please post something :)

     

  • Thomas Stock 40 posts 70 karma points
    Dec 16, 2010 @ 16:21
    Thomas Stock
    0

    Could you post your web.config stuff about membership please?

  • Max Öhman 42 posts 71 karma points
    Dec 16, 2010 @ 16:38
    Max Öhman
    0
           <authentication mode="Forms">
    <forms name="yourAuthCookie" loginUrl="medlemslogin.aspx" protection="All" path="/"/>

    </authentication>
    <authorization>
    <allow users="?"/>
    </authorization>
    <!-- Membership Provider -->
    <membership defaultProvider="UmbracoMembershipProvider" userIsOnlineTimeWindow="15">
    <providers>
    <clear/>
    <add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Another Type" passwordFormat="Hashed"/>

    <add name="UsersMembershipProvider" type="umbraco.providers.UsersMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" passwordFormat="Hashed"/>
    </providers>
    </membership>
    <!-- added by NH to support membership providers in access layer -->
    <roleManager enabled="true" defaultProvider="UmbracoRoleProvider">
    <providers>
    <clear/>
    <add name="UmbracoRoleProvider" type="umbraco.providers.members.UmbracoRoleProvider"/>
    </providers>
    </roleManager>

    This should be the essentials, hope it says something. (I do acctualy have a member typ with the alias "Another Type".)

    I've played around with this code but I don't think I need it:

    <add name="AspNetSqlMemberShipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer" />

     

    and this is changed:

    <forms name="yourAuthCookie" loginUrl="medlemslogin.aspx" protection="All" path="/"/>

    Thank you for taking your time!

  • Thomas Stock 40 posts 70 karma points
    Dec 16, 2010 @ 16:46
    Thomas Stock
    0

    Some extra questions that might help:

    What do you mean exactly with "there is no indication that the login worked"?

    What exactly happens after you press the button on the login form?

    Have you placed a LoginStatus or LoginName control on a page to verify the login?

    What happens when you enter incorrect credentials on the login form?

  • Max Öhman 42 posts 71 karma points
    Dec 16, 2010 @ 17:08
    Max Öhman
    0

    This is what I got in my template  

    <form runat="server">
    <asp:Login ID="Login1" runat="server" DestinationPageurl="/medlemslogin"/>
    <asp:LoginStatus ID="LoginStatus1" LoginText="Login" LogoutText="Logout" LogoutAction="Redirect" runat="server" />
    </form>

    I get the standard error message when trying wrong user info. And when I have the correct ones the page refreshes but the login status doesn't change.

     

  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Dec 16, 2010 @ 18:35
    Thor Madsen-Holm
    1

    Hi Max, 

    When I implemented an asp.net membercontrol in umbraco for the first time, this blog post by Morten Bock helped me a lot: http://www.mortenbock.dk/blog/2009/04/01/setting-up-membership-in-umbraco.aspx

    Maybe it can help you too :-)

  • Max Öhman 42 posts 71 karma points
    Dec 17, 2010 @ 09:22
    Max Öhman
    0

    Yeah I've seen the blog. I've no interest in using the sign up function, but i followed the instructions and tried both with and without sign up and i get the same result of not being able to login. Is it possible that there are some changes in umbraco 4.5 that's not collaborating with this asp.net control?

  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Dec 17, 2010 @ 13:35
    Thor Madsen-Holm
    0

    I don't think so, i used Mortens method on a Umbraco 4.5.2 installation and it worked fine.

  • Max Öhman 42 posts 71 karma points
    Dec 17, 2010 @ 15:43
    Max Öhman
    0

    Now I have tried Mortens method on another site, but still get the same result. this doesn't run:

        <LoggedInTemplate>
            Welcome
            <asp:LoginName ID="LoginName1" runat="server" />
            <asp:LoginStatus ID="LoginStatus1" runat="server" />
        </LoggedInTemplate>

    Is it possible for me to see some of your code?

    Thank you for replying btw!

  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Dec 18, 2010 @ 10:51
    Thor Madsen-Holm
    1

    Hi again, 

    Here is a simple version of my implementation, which works on my site: 

    <form runat="server">

        <asp:LoginView ID="UmbracoLoginView" runat="server">

            <AnonymousTemplate>            

                <asp:Login ID="Login1" runat="server"></asp:Login>

            </AnonymousTemplate>

            <LoggedInTemplate>

                <asp:LoginStatus ID="LoginStatus1" runat="server" />

            </LoggedInTemplate>

        </asp:LoginView>  

    </form>

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 18, 2010 @ 16:51
    Jan Skovgaard
    0

    Hi Max

    Just for the record...

    1. Have you created a member in the member section?
    2. Have you set up a protected page in umbraco with the desired login flow?

    /Jan

  • Max Öhman 42 posts 71 karma points
    Dec 20, 2010 @ 11:01
    Max Öhman
    0

    Hi Thor,
    just tried your code and I seem to get the same result, that the LoginStatus doesn't show. Thank you for posting tho code though. Can ask for another favor? Is it possible to see your web.config? that would help me alot!

    Hi Jan,
    Glad that you joined in :). Yes I've correct member setup, I did create a sign up control which worked. The sign in control detects the correct login info, but if I have DestinationPageurl set to a protected page i get this error.

    Object reference not set to an instance of an object.

    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.

    Does it matter what template contains the control?


  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Dec 20, 2010 @ 22:20
    Thor Madsen-Holm
    0

    Hi Max

    Here is the portion of my web.config where i have added the umbraco membership provider:

    <configuration>  
        <system.web>             
            <membership defaultProvider="UmbracoMembershipProvider" userIsOnlineTimeWindow="15">
                <providers>
                    <clear />
                    <add name="UmbracoMembershipProvider" 
                         type="umbraco.providers.members.UmbracoMembershipProvider" 
                         enablePasswordRetrieval="false" enablePasswordReset="false" 
                         requiresQuestionAndAnswer="false" defaultMemberTypeAlias="WebsiteUser" 
                         passwordFormat="Hashed" />
                    <add name="UsersMembershipProvider" type="umbraco.providers.UsersMembershipProvider" 
                         enablePasswordRetrieval="false" enablePasswordReset="false" 
                         requiresQuestionAndAnswer="false" passwordFormat="Hashed" />
                </providers>
            </membership>
            <!-- added by NH to support membership providers in access layer -->
            <roleManager enabled="true" defaultProvider="UmbracoRoleProvider">
                <providers>
                    <clear />
                    <add name="UmbracoRoleProvider" type="umbraco.providers.members.UmbracoRoleProvider" />
                </providers>
            </roleManager>
            <!-- Sitemap provider-->     
        </system.web>   
    </configuration>
  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 20, 2010 @ 22:41
    Jan Skovgaard
    0

    Hmm...

    I have not played aroun with the settings in the web.config when I have been using the asp:login control...

    I have just placed my user control on a specific login template and then setup the public access on the specific node tree in my content section that needs to be restricted.

    /Jan

  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Dec 20, 2010 @ 22:46
    Thor Madsen-Holm
    0

    As far as i know you're absolutely right Jan, i added the membership provider to let umbraco know which member type to use when creating new members. 

  • Max Öhman 42 posts 71 karma points
    Dec 21, 2010 @ 08:44
    Max Öhman
    0

    I realize that the control shouldn't cause all this problem. All the code checks out, there's something else that's wrong. Can I just get conformation that we run the same framework and versions... Can you find these three lines in your config?:

    <pages enableEventValidation="false" validateRequest="false" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
    <compilation defaultLanguage="c#" debug="false" batch="false" targetFramework="4.0">
    <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />

    I will probably have to postpone this project till after the holidays. Sometime you have to realize when you are beaten...

    Thank you so much Thor for posting the code. And both of you for trying to help me out, means a lot!

  • Jan Skovgaard 11280 posts 23678 karma points MVP 11x admin c-trib
    Dec 21, 2010 @ 09:58
    Jan Skovgaard
    0

    Hi Max

    Unfortunately I can't check the my solution from this machine I'm sitting on right now. But will make a check later this evening. But as far as I can see and remember it looks right.

    I'm thinking it might is a permission issue? What permissions have you given the network service and iusr? (It's a long shot).

    /Jan

  • Thor Madsen-Holm 82 posts 212 karma points c-trib
    Dec 21, 2010 @ 14:10
    Thor Madsen-Holm
    0

    Hi Max, 

    The lines you are posting look exactly the same in my web.config, so those linies should'nt be the problem. 
    As Jan says it could be worth a try to tjek your permission settings. 

    /Thor 

  • Max Öhman 42 posts 71 karma points
    Sep 06, 2011 @ 16:39
    Max Öhman
    0

    All I wanted to add to this thread is a thx to the guys engaged in my problem. Aaaand that I had to upgrade my Umbraco version to 4.7.

Please Sign in or register to post replies

Write your reply to:

Draft