Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. implement membership in asp.net

implement membership in asp.net

Scheduled Pinned Locked Moved ASP.NET
csharpasp-net
9 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    Jagz W
    wrote on last edited by
    #1

    i want to implement membership in my project. i read about it...and find we can create roles using web site administration tool. but my requirement is that the client wants to change the roles of users on daily bases. how this can we achieved using roles in asp.net 2.0

    One person's data is another person's program. --J.Walia

    S C A J 4 Replies Last reply
    0
    • J Jagz W

      i want to implement membership in my project. i read about it...and find we can create roles using web site administration tool. but my requirement is that the client wants to change the roles of users on daily bases. how this can we achieved using roles in asp.net 2.0

      One person's data is another person's program. --J.Walia

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      The best way IMO is to write your own system, not use the built in rubbish.

      Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

      A 1 Reply Last reply
      0
      • J Jagz W

        i want to implement membership in my project. i read about it...and find we can create roles using web site administration tool. but my requirement is that the client wants to change the roles of users on daily bases. how this can we achieved using roles in asp.net 2.0

        One person's data is another person's program. --J.Walia

        S Offline
        S Offline
        sashidhar
        wrote on last edited by
        #3

        You have to do it programmatically..! for eg:to find the roles of the user

        Response.Write (User.Identity.Name + " is a member of " + Roles.GetRolesForUser().Length + " Roles.<BR>");

            Response.Write("User Roles" + "<BR>");
            foreach (string role in Roles.GetRolesForUser())
            {
                Response.Write(role.ToString() + "<BR>");
            }
            Response.Write("All Roles" + "<BR>");
            foreach (string role in Roles.GetAllRoles())
            {
                Response.Write(role.ToString() + "<BR>");
            }
        

        LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

        C 1 Reply Last reply
        0
        • S sashidhar

          You have to do it programmatically..! for eg:to find the roles of the user

          Response.Write (User.Identity.Name + " is a member of " + Roles.GetRolesForUser().Length + " Roles.<BR>");

              Response.Write("User Roles" + "<BR>");
              foreach (string role in Roles.GetRolesForUser())
              {
                  Response.Write(role.ToString() + "<BR>");
              }
              Response.Write("All Roles" + "<BR>");
              foreach (string role in Roles.GetAllRoles())
              {
                  Response.Write(role.ToString() + "<BR>");
              }
          

          LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          How does that allow him to change roles ? Can he add roles and remove them programatically too ?

          Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

          S 1 Reply Last reply
          0
          • C Christian Graus

            How does that allow him to change roles ? Can he add roles and remove them programatically too ?

            Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

            S Offline
            S Offline
            sashidhar
            wrote on last edited by
            #5

            Yes my friend..! add role

            Roles.AddUserToRole(userName, "rolename");

            :thumbsup:

            LatestArticle :Log4Net Why Do Some People Forget To Mark as Answer .If It Helps.

            1 Reply Last reply
            0
            • C Christian Graus

              The best way IMO is to write your own system, not use the built in rubbish.

              Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.

              A Offline
              A Offline
              AlexeiXX3
              wrote on last edited by
              #6

              Dont make it difficult for this guy Chris, it looks like he is new, so using the included membership system is the best option in this case

              Alexei Rodriguez

              1 Reply Last reply
              0
              • J Jagz W

                i want to implement membership in my project. i read about it...and find we can create roles using web site administration tool. but my requirement is that the client wants to change the roles of users on daily bases. how this can we achieved using roles in asp.net 2.0

                One person's data is another person's program. --J.Walia

                A Offline
                A Offline
                AlexeiXX3
                wrote on last edited by
                #7

                Take a look at the Roles class[^] You can create, delete and read roles, as well as adding and removing users to and from roles For instance, you can show a gridview with all users and a checkboxlist with all the available roles that can be assigned to the selected user

                Alexei Rodriguez

                1 Reply Last reply
                0
                • J Jagz W

                  i want to implement membership in my project. i read about it...and find we can create roles using web site administration tool. but my requirement is that the client wants to change the roles of users on daily bases. how this can we achieved using roles in asp.net 2.0

                  One person's data is another person's program. --J.Walia

                  J Offline
                  J Offline
                  Jagz W
                  wrote on last edited by
                  #8

                  i m confused now... what to do?? should i use membership or not??

                  One person's data is another person's program. --J.Walia

                  OriginalGriffO 1 Reply Last reply
                  0
                  • J Jagz W

                    i m confused now... what to do?? should i use membership or not??

                    One person's data is another person's program. --J.Walia

                    OriginalGriffO Offline
                    OriginalGriffO Offline
                    OriginalGriff
                    wrote on last edited by
                    #9

                    I would certainly start by using the Membership class, as it hides a lot of the database interaction from you and provides a reasonable basic user management system that works with SQL Sever, mySQL, etc. It includes everything you need to get your head around, including encrypted passwords, user approval, roles, and applications so you can concentrate on your logic, rather than re-inventing the wheel. When you need to extend, then look at deriving from Membership first.

                    No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced. This message is made of fully recyclable Zeros and Ones

                    "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
                    "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups