How To Add User Role Using MS Access DB

Jul 18, 2012

trying to get a login script working, its working fine, but now i have a new problem, i have a field im my DB thats called "urole" in that i have 3 roles, Admin, Co-Admin, User.

How can i use something like this on a page.

Code:

If Roles.IsUserInRole("Admin") Then
Label1.Text = User.Identity.Name + " is an Admin"
Else
Label1.Text = User.Identity.Name + " is NOT in an Admin"
End If

I have this script on my login page

Code:
Imports System.IO
Imports System.Data
Imports System.Data.OleDb
Imports System.Web.Configuration
Partial Class DbLogin
Inherits System.Web.UI.Page

[code]....

and then i have this on my default page, thats shows the info from an user, now i just want to show the role (urole) and then use an "If Roles.IsUserInRole" event so i can show some diffrent thing if admin, co-admin or User

Code:
Imports System.IO
Imports System.Web.Security
Partial Class _Default
Inherits System.Web.UI.Page

[code]....

(The aboved is working fine, but its not showing the urole/Role of an user)

View 12 Replies


Similar Messages:

Access To IIS_WPG User Role In IIS?

Feb 26, 2010

How can i give access to IIS_WPG user role in IIS.

I am trying to run .net 2.0 application on windows xp laptop

View 3 Replies

C# - Access Datas Based On User Role?

Mar 21, 2011

How to access datas based on user roles in asp.net ? For example : i have two admins (admin1, admin2). In the frontend ,admin1 has full access to datas(view,add,edit,delete all datas) while admin2 has limited access to datas(view,add,edit,delete certain datas alone and not all datas)

View 2 Replies

Security :: Enable User To Edit / Delete Based On User's Role Permission

Feb 24, 2011

I'm trying to allow logged user who are in department XYZ to perform some task for my third party App. I have two SQL tables named Users & UserList. The third party app (GoldMine) graps the USERNAME from the Users table and store it as UserID which I then referecnce SessionID. The UserList table has two columns (GM_UserName & Department) which I'm interested in. When a user login into the 3rd party app (GoldMine), i then compare the USERNAME (from Users table) to GM_UserName (from UserList table) and see whether GM_UserName is in = 'Dept XYZ'. Take a look at the SQL query below.

sqlDept = "SELECT USERNAME FROM Users LEFT JOIN UserList ON UserList.GM_UserName=Users.UserName WHERE UserList.Department ='Dept XYZ'"

I'm able to do this.

If Session("Userid") = "TestUser1" Or Session("UserID") = "TestUser2" Then Do this Else Do that End If
BUT unable to do this...
If user's Department = 'Department XYZ' Then
Do This
Else
Do that
End IF

View 2 Replies

MVC :: Strongly Typed User Control On All Pages Based On Login Status And User Role

May 9, 2010

I want to display a menu (which will be strongly typed with it's own unique model) across all pages only if a user is logged in.What menu items are available depend on the user's role and also I'll need to hit the repository to get numbers like "x Messages", etc

Been scratching my head for a simple solution here. Don't want to create something that need changes all over the place.All my controllers derive from a BaseController, all my Models from BaseViewModel....probably where I'll be implementing functionality for this.

View 3 Replies

User Controls :: Show Hide Specific Section Of Page Based On User Type Or Role

May 7, 2015

I have LOGIN PANEL for student, and I want to disable it in different page. And only the admin can enable and disable it. I dont know the logic behind here.

View 1 Replies

C# - How To Set User Control Visibility, Upon User Role

Mar 11, 2011

I want to implement access control for usercontrols depending on user role(s), I want to do it on the control base class, in such way that on every user control I only need to set a string with allowed roles to see the user control

This is how an user control class may look like:

public partial class SimpleMenu : MyUsrControlBase
{
protected void Page_Load(object sender, EventArgs e)[code]...

How to set up user control visibility from the base class depending on the validation result?Also which event in the user control is the best to set the roles?

AlloweRoles = "RoleA, RoleB"

View 1 Replies

Security :: Role Base Access Page?

Dec 25, 2010

I have a Table In DataBase Role.

Which Contain the Role

1. SuberAdmin

2. Admin

3. Coordinator

4. Agency

5. Agent

Which have the different- different Access of pages so now how i give the seetings in Web to access the page according to role.

View 8 Replies

Security :: Denying Access With Role Authentication?

Mar 18, 2010

1. How do i limit access to admin directory to only admin roles ?I logged in with a user whose role is Customer and went to the url of mysite.com/admin/ and it shows be the directory listing for that directory.

2. Have I implemented the roles/web.config correctly ?

[Code]....

View 3 Replies

Web Forms :: Sitemap: Can't Sub Nodes Further Restrict Role Access

Sep 24, 2010

I have a menu in my application (created from the sitemap) which I want available to two user roles. However, there are items on that menu, I want available only to one role or the other. So I have created the following in my sitemap.

[Code]....

Essentially, I want employees with the "TimeUser" role to see the "My Profile" link that goes to the EmpProfile.aspx page, but not the link to the client profile page. However, when an employee logs in, they see both. I am guessing this may be because the "My Account" node which contains them allows both roles. Is there a way around this without duplicating the "My Account" node?

View 2 Replies

Web Forms :: Add "role" Parameter / Property To User Control Containing LoginView Control To Set "Role" Possible?

Jan 13, 2010

I am in the process of creating a user control that enables content areas of our web application to be editable. The control utilizes the asp.net membership/role providers and incorporates a LoginView that only displays the edit link if a user has logged in and is a member of the desired role. What I would like to be able to do is pass the "role" as a property of the control so it can be set dynamically and does not have to be hard coded into the control if I use elsewhere in another application.

View 3 Replies

Security :: Direct Access To The Page Using Role & Membership Provider?

Feb 15, 2011

I have a web app developed using role & membership provider...

this is my web.config file

<authentication mode="Forms">
<forms loginUrl="Forms/LogIn.aspx" name=".ASPXFORMSAUTH" defaultUrl="Forms/main.aspx" timeout="30"></forms>
</authentication>[code]....

So i would like that the page "pag1.aspx" is reached bypassing the "main.aspx" so If I try to digit directly on the server http://localhost/forms/pag1.aspx?C=159 ......correctly appears the login page....and the URL became..

http://localhost/Forms/LogIn.aspx?ReturnUrl=%2fForms%2fpag1.aspx%3fC%3d151&C=159 and after login I can see correctly the page1.aspx . when I try to reach the page from my browser..I digit

http://myserver/forms/pag1.aspx?C=159 .... the login page appears...but the url became..

http://myserver/Forms/main.aspx

and after login I cannot see the page1.aspx....but main.aspx

View 1 Replies

Web Forms :: Role Based Authorization And Page Access Using Session?

Jun 16, 2015

i am developing the web application in Asp.net i hav many .aspx pages in the project some of belongs to Admin and some some of to Customer so how can i divide that and how to access admin pages to admin login and customer pages to customer login.  

View 1 Replies

Security :: How To Get The User's Role

Jan 22, 2011

Is there any way that I can find the exact name of the role a User is in? There is a property for UserName ( User.Identity.Name) but what about the role?

View 1 Replies

VS 2008 How To Change The User's Role From One To Another

Feb 18, 2010

In code, how can I change the user's role from one to another?

Let's say the user1 is in Role1. I would like to change his role to Role2.

View 6 Replies

Security :: How To Add Role To New User Upon Creation

Dec 10, 2010

I have a page setup to manage and create users.. in order to help the process of creation, i woudl like to add the new users to our default "users" role when they click the create button. Below is what is in place for the creation page and the button event tied to the button. I used this from a tutorial i found else where, but dont have the link at the moment if anyone needed it.. but the code below works great when creating a new user

[Code]....

View 5 Replies

Programmatically Add User Role To COM+ Component (C#)

Mar 2, 2010

I wish to know the way to add ASP.NET ("Machine_Name"IIS_IUSRS) to user role in COM+ component programmatically using C#. So whenever my COM+ component is being installed, ASP.NET user is created under Role.

View 1 Replies

C# - Get Role Of User In A String Variable?

Jan 21, 2010

is there a way i can get the role in a string variable using the below commands....

System.Security.Principal.WindowsIdentity wi = System.Security.Principal.WindowsIdentity.GetCurrent();
System.Security.Principal.WindowsPrincipal wp = new System.Security.Principal.WindowsPrincipal(wi);


i need this for

FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, // version
UserName.Text, // user name
DateTime.Now, // creation
DateTime.Now.AddMinutes(60),// Expiration
false, // Persistent
role); // User data

as string role= wp.IsInRole();
but this is not right

View 5 Replies

Security :: Can't Save Role Of User

Feb 12, 2011

The roles of users are not saved. Here is what i am doing:

[Code]....

And i added this to the create user wizard:

<asp:WizardStep ID="SpecifyRolesStep" runat="server" StepType="Step"
Title="Specify Roles" AllowReturn="False">
<asp:CheckBoxList ID="RoleList" runat="server">
</asp:CheckBoxList>
</asp:WizardStep>

View 1 Replies

Security :: Get The Role Of The User Using Memebership

Dec 31, 2010

I need to get the role of the user using memebership.

View 2 Replies

XmlSiteMapProvider Check User To Be In Specified Role?

May 22, 2010

I roll my own SiteMapProvider inheriting System.Web.XmlSiteMapProvider.I want to override logic of checking user to be in a role specified in siteMapNode's property roles:

<siteMapNode url="Add.aspx?type=user" title="Add user" roles="admin" />

How can I do that? Which class's member does XmlSiteMapProvider call to check that if securityTrimmingEnabled="true"?

View 2 Replies

Setting Role When Creating New User With MVC?

Mar 31, 2011

Setting role when creating new user with ASP.net MVC

I am looking at the default ASP.net MVC 2 controller.

How do I set the role for the new user that is created in the Register method?

Is this possible with just a simple property set or do I have to do something special?

View 1 Replies

Verification A User's Role And Approval

Nov 11, 2010

There used to a lot of tutorials on the asp.net site and I can't find any of them anymore. Anyway, I'm looking for a tutorial on how to send out an email to the newly registered user for verficiation. After the user checks his/her email and click the link in the email, it automatically unlock the user's account and allow him/her to login to the site. Below is what I have so far:

[Code]....

[Code]....

And verification page_load:
[Code]....

The user does receive the verification email and when he/she click on the link it does come over to the verification.aspx page; however, the user still can't login. When I looked at the status of the user, it's still locked.

View 2 Replies

Security :: Checking User For Particular Role?

Jan 28, 2011

im using forms authentication and created roles.

while the user enters the credentials im authenticating the user with username and password

now i also want to check the particular user whether he is that role.

eg:

if username,password are true and role is Admin i redirect him to Adminhome.aspx

else to empHome.aspx.

im able to chek username and password but im unable to detect the role.

[Code]....

View 6 Replies

Security :: Redirect User By Role After Logging In (VB.NET)?

Feb 4, 2010

I have a login form from the membership and I am trying to make it so that it would redirect depending on role. I have tried to put this code under login1_loggedin but it didn't seem to work. how can I do this?

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved