Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 30-03-2009
Member
 
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?
Reply With Quote
  #2  
Old 30-03-2009
Member
 
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
Reply With Quote
  #3  
Old 30-03-2009
Member
 
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.
Reply With Quote
  #4  
Old 30-03-2009
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to Assign the Users and Roles in VB and VB.NET"
Thread Thread Starter Forum Replies Last Post
SBS 2008 Cannot see roles and features Zylawys Networking & Security 1 11-05-2012 11:21 AM
How to create a GPO link to a OU that will assign automatically a security group to the users on that OU. antonyrugama Active Directory 2 15-11-2011 02:45 AM
How to assign permission to users to change Remote desktop. nitin11june Operating Systems 1 04-08-2011 04:27 PM
Users,Roles and privileges in Oracle Garlands Software Development 4 29-01-2010 02:56 PM
FSMO roles bethamprashanth Networking & Security 3 26-05-2009 12:03 PM


All times are GMT +5.5. The time now is 03:11 AM.