Copied to clipboard

Flag this post as spam?

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


  • Base 28 posts 49 karma points
    Mar 16, 2010 @ 17:22
    Base
    0

    Basic user authentication issue

    Hi!

    Have some problems. Got errors from a usercontrol i created so tried inserting the following to a page template wich is used on a page:

    <%@ Master Language="C#" MasterPageFile="/masterpages/ogc-master.master" AutoEventWireup="true" %>
    <asp:Content ContentPlaceHolderID="oGcContentHead" runat="server">
    <img src="/media/assets/ogc/mnu-medlem.png" alt="" />
    </asp:Content>
    <asp:Content ContentPlaceHolderID="oGcContentMain" runat="server">
    <% if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated) {}; %>
    <asp:Login ID="Login1" runat="server" DestinationPageUrl="/"></asp:Login>
    </asp:Content>

     

    This generates an "objectreference not set to an instance of the object" error and marks the row:

    Rad 6:  <% if (System.Web.HttpContext.Current.User.Identity.IsAuthenticated) {}; %> 

    My guess is im probably missing something basic here although i do not know why, everything looks ok.
    Its a default clean umbraco install with a 100% default web.config.

    Any tips on what im missing here?

  • Dirk De Grave 4537 posts 6006 karma points MVP 3x admin c-trib
    Mar 16, 2010 @ 17:22
    Dirk De Grave
    0

    Do you have a member group setup, which should be same as in the web.config?

     

    Cheers,

    /Dirk

  • Base 28 posts 49 karma points
    Mar 16, 2010 @ 19:26
    Base
    0

    I missed that completeƶy but didnt seem to solve my problem.

    I added a group as such in umbraco members.

    Then i added that group in my membership providers as below:

    <providers>
                    <clear />
                    <add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="RegisteredUser" />
                    <add name="AspNetSqlMemberShipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="LocalSqlServer" />
                    <add name="UsersMembershipProvider" type="umbraco.providers.UsersMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" />
                </providers>

    BUT i still get the objectreference error on:

    Rad 6:  <% if(System.Web.HttpContext.Current.User.Identity.IsAuthenticated) {} %>

    I set up one user and it seemed to work to login with the member i added in the admin view. But i cannot seem to be able to query the user status / info etc. I tried pasting the prefereed asp.net 3.5 template in the web.config to be shure i havent screwed anything without noticing it(the above is tested after this), but didnt do any good unfortunatly.

     

  • Base 28 posts 49 karma points
    Mar 16, 2010 @ 20:42
    Base
    0

    So ive done some more testing and partly solved it.I noticed when using the asp:CreateUserWizard i also got "No node exists with id '0'".
    When looking back as you said i tried to add the groupname but it needed the member type alias(stupid of me). I added the alias for my
    member type and nw it works to register new users through the createuserwizard.

    Though strangely the IsAuthenticated call still gives out errors.

  • Peter Dijksterhuis 1442 posts 1722 karma points
    Mar 16, 2010 @ 21:21
    Peter Dijksterhuis
    0

    Have a look at this thread, maybe it'll help you as well.

    http://our.umbraco.org/forum/using/ui-questions/7668-Membership--Login?p=2#comment28243

    Peter

  • Base 28 posts 49 karma points
    Mar 16, 2010 @ 21:23
    Base
    0

    I did some more tests and added a asp:LoginView to the page. It seems like this control do not recognise me when i log on using the asp:login control with an account i created.

    Its kindoff strange that i can create a new user with the createuserwizard, but then it seems like the current user information is not available to me or to the membership controls.

  • Base 28 posts 49 karma points
    Mar 16, 2010 @ 21:24
    Base
    0

    Ah will check that out immidiatly

  • Base 28 posts 49 karma points
    Mar 16, 2010 @ 21:28
    Base
    0

    Great it seems to be the same problem. Not tried the solution yet but by using the pages with the full url including .aspx it seems to work!

  • Base 28 posts 49 karma points
    Mar 16, 2010 @ 21:31
    Base
    0

    yeah adding  

    <remove name="FormsAuthentication" />
                <add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule"/>

    to web.config / modules worked great, thx a bunch!

  • Base 28 posts 49 karma points
    Mar 16, 2010 @ 21:37
    Base
    0

    Or maybe not, one thing still messes with me. The login parts seems to work now. But using IsAuthenticated, it works when im logged on, but after i logout it only works with .aspx, generating objectreference error when using url without .aspx. Though i will do some checking on this perhaps something else i need to adjust. I know how a way to make it work atleast, thats the most important atm.

  • Base 28 posts 49 karma points
    Mar 16, 2010 @ 21:40
    Base
    0

    Correction, saw the comment in the other thread about adding runAllManagedModulesForAllRequests="true" to modules as well.

    With that change everything works fine. Thx alot guys for helping me out with this. Umbraco really seems to be a kickass combo of control and useability :)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies