Copied to clipboard

Flag this post as spam?

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


  • Alex Perotti 2 posts 22 karma points
    Jul 21, 2011 @ 10:23
    Alex Perotti
    0

    Membership issue

    Hello,

    I got a problem using the .net Membership Provider.

    I'm developing a user control to give a friendly ui (in the website, not in backend) to manage users.

    When I list the website members, the LastLogin and the LastLookout, LastActivity and LastPasswordChange date fields are always set to DateTime.Now() for all the users (even users that never logged in).

    Here's the page code

                foreach (MembershipUser m in Membership.GetAllUsers())
                {
                    DefaultMemberProfile mp = (DefaultMemberProfile)ProfileBase.Create(m.UserName);

                    tr = new TableRow();
                    tc = new TableCell();
                    tc.Text = "<input type=\"radio\" id=\"" + m.ProviderUserKey.ToString() + "\" name=\"users\" value=\"" + m.ProviderUserKey.ToString() + "\">";
                    tr.Cells.Add(tc);
                    tc = new TableCell();
                    tc.Text = m.UserName;
                    tr.Cells.Add(tc);

                    tc = new TableCell();
                    tc.Text = m.Email;
                    tr.Cells.Add(tc);

                    tc = new TableCell();
                    tc.Text = mp.FirstName + " " + mp.LastName;
                    tr.Cells.Add(tc);

                    tc = new TableCell();
                    tc.Text = m.LastLoginDate.ToString("dd/MM/yyyy - hh:mm:ss") + "////" + m.CreationDate.ToString("dd/MM/yyyy - hh:mm");
                   
                   
                    tr.Cells.Add(tc);

                    tc = new TableCell();
                    tc.Text = (m.IsApproved ? "Si" : "No");
                    tr.Cells.Add(tc);


                    tc = new TableCell();
                   

                    string[] roles = Roles.GetRolesForUser(m.UserName);

                    for (int i = 0; i < roles.Length; i++)
                        tc.Text += roles[i] + " ";
                       
                   
                   
                    tr.Cells.Add(tc);

                    t.Rows.Add(tr);

                }

     

    Any idea?

     

    thanks in advance

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Jul 22, 2011 @ 11:44
    Bo Damgaard Mortensen
    0

    Hi Alex,

    Quite a shot in the dark here, but have you tried to DateTime.Parse() your date values? :-)

    - Bo

  • Dirk De Grave 4541 posts 6021 karma points MVP 3x admin c-trib
    Jul 22, 2011 @ 12:05
    Dirk De Grave
    0

    I'm not sure about all variables you mention, but may need to check on the membership configuration in web.config. An overview of all (extra) attributes on the umbraco membership provider can be found in the wiki.

     

    Cheers,

    /Dirk

Please Sign in or register to post replies

Write your reply to:

Draft