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


Similar Messages:

Roleprovider - .NET User/Role Management In VS2010 - Skipping Over The SQL Express Version And Going Straight To SQL Server 2008 R2

Jan 28, 2011

As I'm learning the ins and outs of ASP.NET user management, I've learned that the default in VS is for it to use a SQL Server Express .mdf file for the data it needs to save. This won't help me for when I deploy my site, as I'm running SQL Server 2008 R2 on my IIS 7.5 server. I know that I can run a command line tool to automatically create the db tables necessary for user management, and will do that on my development machine, but how do I tell my existing, in development code in VS to ignore the existing Express .mdf file and look at the newly created db tables?

View 1 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

VS 2008 Creating Role Based Authorization?

Feb 9, 2011

I have seen articles on Role Based Authorization in MS-Sql server-Asp.net but i did not find any article in MySql-ASP.net/vb.net, i am acheived this concept using session user name i am enabling certain parts of website to group A and certain parts of site to Group B but when i have more groups i cannot use this method.

Myrequirement is:

In Web applications, typically there exist certain parts of the site that only certain folks, or groups of persons can access. For example, imagine Web site used to administer the content on a company's public Internet Web site, where the public Web site lists products sold by the company. From the administrative site, all company employees might be able to make minor changes to the products' descriptions, quantity, and other such non-essential information. However, perhaps only a subset of trusted employees might be able to change the products' prices. And even a smaller subset of employees would be able to add new products or delete existing products from the database I would be delighted if any one provide the solution

View 9 Replies

VS 2008 - Role Based Authorization For ASPX Pages

Aug 2, 2011

I am having a very simple intranet site. I took the sample for my project from [URL] ....

I have integrated windows authentication with Role based authorization. There are only 3 .aspx pages and I have a tree view control on the master page. depending on the choices that the user's make on the tree view control the .aspx pages gets displayed.

There are only 2 active directory groups. Sales and Marketing. My network id is not in Sales AD group.So obviously it prompts me to put userid and password and it throws not authorized error when i try to access PortfolioData.aspx page. So far so good.

But I am a member of AD group MARKETING. I should be able open the page Schedules.aspx (please see the config file below). But I still get the Error message 401.2.: Unauthorized: Logon failed due to server configuration.

Code:

<!--
<authorization>
<allow roles="domainADGROUP_SALES"/>
<deny users="*"/>
</authorization>

[Code] .....

View 2 Replies

VS 2008 - Role Based Security Not Working In Application

Jul 12, 2011

I have an asp.net application. This is a role based authorization. Basically, if the user's are in a specific AD group, it should allow them to look at the webpage. Otherwise it should error out saying "not authorized".

In the web.config file, I have the following lines of code. I made sure I am in the Apr-Sales-Writers AD group.

Code:
<authorization>
<allow roles="Apr-Sales-Writers"/>
<deny users="*"/>
</authorization>

Issue: when I go to default.aspx page, it prompts for a userid and password and even though I put correct password and userid, it says "not authorized error".

Code:
Access is denied.
Description: An error occurred while accessing the resources required to serve this request. The server may not be configured for access to the requested URL.

Error message 401.2.: Unauthorized: Logon failed due to server configuration. Verify that you have permission to view this directory or page based on the credentials you supplied and the authentication methods enabled on the Web server. Contact the Web server's administrator for additional assistance.

In the IIS project (on IIS server), I configured it to be a "Integrated windows authentication".

View 1 Replies

Web Forms :: Role Change DropDown Based?

Jul 30, 2010

1) I'm currently working for HR application with security roles

2) for that I created dynamic menu and set data source to sitemapprovider control with "AspNetSqlSiteMapProvider"

Now my client requirement is to change menu's based on drop down selection so that menus will be minimum and quite user friendly.for that I did following steps:-

Created Drop Down contains list of all Roles provided him in Master Page In Menu1_MenuItemDataBound event I grabbed the roles for that node and compared with role selected in drop down and deleted that node now what i need is on drop down_selected index change I want to recreate menu.

View 9 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

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 :: 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

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

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

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

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

Security :: Want To Redirect The User After The Log In Based On His Role?

Mar 17, 2011

i want to redirect the user after the log in based on his role. e.g. admin, userI already read the other threads.. I already used this:

[Code]....

And this:

[Code]....

I also tried the above codes on the Page_Load event.

View 7 Replies







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