Results 1 to 4 of 4

Thread: How to Assign the Users and Roles in VB and VB.NET

  1. #1
    Join Date
    Feb 2009
    Posts
    81

    How to Assign the Users and Roles in VB and VB.NET

    We can define Users and Roles for databases and tables in SQL server but i wonder how this can be implemented in real time applications developed in platforms like VB, VB.Net etc..

    I mean when we create applications, we do create the login form to enter the application. Once a user is inside the application, he/she should be having different privileges. Some users can only view the informations and some can add/edit/delete informations through the application. So, i wanna know how this is done?

  2. #2
    Join Date
    Mar 2008
    Posts
    232

    Re: How to Assign the Users and Roles in VB and VB.NET

    Hi

    You can assign user to roles by handle the OnCreatedUser event. Here is an example in VB.NET Hope it helps


    Code:
      Protected Sub CreateUserWizard1_CreatedUser(ByVal sender As Object, ByVal e As System.EventArgs) Handles CreateUserWizard1.CreatedUser
            Roles.AddUserToRole(CreateUserWizard1.UserName, "rolename")
        End Sub

  3. #3
    Join Date
    Dec 2008
    Posts
    183

    Re: How to Assign the Users and Roles in VB and VB.NET

    To create the Users and Roles you have to create a table in the database with user ids and their various privileges.

    When the created users logs in to the query table to get their current privileges into an array.

    Then in the application layer control via code which pages or features they are allowed to access based on the values in the array.

    Changing the DB privileges directly seems or reflects in the VB project window.

  4. #4
    Join Date
    Oct 2008
    Posts
    167

    Re: How to Assign the Users and Roles in VB and VB.NET

    Authentication is the process of identifying a user; authorization is the process of deciding which parts of your application that user can see and interact with. The forms-based security controls and database that comes with Visual Basic 2005 allows you to set authorization for specific users based on their being assigned to a role (such as guest, member, manager, etc). You do so in three steps: create the roles, assign permissions to each role, and then assign users to the roles. Any given user may be in more than one role (e.g., administrator and manager). The permissions you assign to each role may determine access to a page, or may change the content of a given page displayed to members of that role.

    To demonstrate how to create roles and assign users to those roles, you’ll need to create a new application, ASPSecurityRoles.

    pen Web.config and you’ll see that the WAT has updated it to add roles management:
    Code:
      <system.web>
        <roleManager enabled="true" />
        <authentication mode="Forms"/ >  
        <membership defaultProvider="AspNetSqlMembershipProvider"/>
        <compilation debug="true"/>
      </system.web>
    Depending on how your machine is set up and which database you are using, you may or may not have thedefaultProviderentry in yourWeb.config.

Similar Threads

  1. SBS 2008 Cannot see roles and features
    By Zylawys in forum Networking & Security
    Replies: 1
    Last Post: 11-05-2012, 11:21 AM
  2. Replies: 2
    Last Post: 15-11-2011, 02:45 AM
  3. How to assign permission to users to change Remote desktop.
    By nitin11june in forum Operating Systems
    Replies: 1
    Last Post: 04-08-2011, 04:27 PM
  4. Users,Roles and privileges in Oracle
    By Garlands in forum Software Development
    Replies: 4
    Last Post: 29-01-2010, 02:56 PM
  5. FSMO roles
    By bethamprashanth in forum Networking & Security
    Replies: 3
    Last Post: 26-05-2009, 12:03 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,613,264.79079 seconds with 17 queries