Check user role

How do you check to see if a user is member of a particular role created in DNN?  I've tried using:

If PortalSecurity.IsInRole("Production") = True Then...
and also
If context.User.IsInRole("Production") = True Then...
but neither of them seems to work. Weird thing is I believe one of the two code used to work but doesn't seem to. Thanks.
0
kikkoman
10/21/2004 7:47:06 AM
asp.net.dotnetnuke-get-started 5241 articles. 0 followers. Follow

1 Replies
487 Views

Similar Articles

[PageSpeed] 24
Get it on Google Play
Get it on Apple App Store

I believe that IsInRole() takes the RoleId as a string parameter, not the RoleName.
~Chris

Net Data Design
706Horsman.us
0
cjsmitty
10/21/2004 11:05:44 AM
Reply:

Similar Artilces:

Problem : Get a list of user belonged to a role or to know if a user already has a role
What code can I write to know if a user belonged to a Role already ? and How can I get a list of a  user already in an existing role ? Please have a look at my code below : Protected Sub AddUsers_OnClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddUsersToRole.Click' I wanna add some code here to check if a user already belonged to a Role' Please insert your code here. Thanks a lot. ' A role must be selected If RolesListBox.SelectedItem Is Nothing Then Msg.Text = "Please select a role." Exit Sub End If ...

How do I check whether a user is in a role when the user is not yet authenticated
My problem:  Users coming through a portal are automatically authenticated as guests, using a standard password that nobody ever sees.   However they can also register as normal users, in which chase they have their individual password which they know, and the usual functions to reset their password, handle a forgotten password, and so on.So, in my register-from-portal code, after recognizing that this is a returning user we need to authenticate the user: but we don't know whether to use the standard portal password, or request an individual password.  I would like to writ...

get user role..
Dim currentrole As String = Roles.GetRolesForUser It will not let me write this, but I am trying to assign the current users role to the variable currentrole..   could anyone help me? http://msdn.microsoft.com/en-us/library/ms998314.aspxAvantha SiriwardanaBeware of bugs in the above code; I have only proved it correct, not tried it. (Donald Knuth) Hi mattatuni2, It's probably caused by missing namespace. Please try to add namespace "System.Web.Security" first. Thanks.David QianMicrosoft Online Community SupportPlease remember to mark the replies as answers if th...

Get all user by roles
I have some problem that I want every body help me. Example: I have 2 roles as "Student" & "Teacher". In this role have more memership. I would select all users that have role "Student" & have role "Teacher".  Do you have any solution?  Thank you,Thank you,IT Manager  Roles.GetUsersInRole("Student"); Roles.GetUsersInRole("Teacher"); If this post was useful to you, please mark it as answer. Thank you!Regards.mimranshafiq.NET Web Developerhttp://www.dotnetclassic.com Thank you for your su...

How to check user role
I'm creating a module that I want to display certain things to specific roles. How do I check the roles of the currently logged in user? Sorry if this is a newb question but really not sure how this is done. ThanksCheersmidspot Hmm - you can use PortalSecurity.IsInRole to check if the logged on user is in a specific role or array of roles.. or                 RoleController roleController = new RoleController();                 roleController.GetUserRolesByUser...

Check if user is in role
Hello,I need to check if a user with a certain username is in a specific role.This is not the current user which is logged on.How can I do this?Thanks,Miguel UserIsInRole();CheersAlMy BlogMapStats.NETPlease click on 'Mark as Answer' if this post answered your question! Visual Basic If User.IsInRole("members") Then buttonMembersArea.Visible = True End If C# if (User.IsInRole("members"))  { buttonMembersArea.Visible = True; You might want to have a look at this: http://msdn2.microsoft.com/en-us/library/5k850zwb.aspx...

how to get all user by role
how can i get all user by roleName in asp.net role base provider? Provided you have the role provider set up in your web.config the following code would work. Dim Users() As String = Roles.GetUsersInRole("RoleName") For Each UserName As String In Users Response.Write(UserName) Next...

how to get start with .NET
the net help people installed  to my desktop 1-microsoft visual studio .NET enterprise developer 2003 2-microsoft .NET framework 1.1 what else do i need ...???  and how can i try with some simple code in VS.Net and run it to see wat happen...????? please help If you want to develope web applications, then you'll also need IIS on your PC.  That'll require XP-Professional or Windows 2000/2003, but XP-Home edition won't allow IIS installation. As for how to get started, you can search the web for some tutorials or buy a good book on VS.  The topic is way too vast to...

Getting Started with DotNetNuke
I have successfully installed the software, created and connected to the database. When I go to the Default.aspx page it takes me to the "Welcome to DotNetNuke..." page. It says: "Select the Host tab to manage multiple portals as the Host.", but there is no Host tab. Where do I go from here? Also, is there a development environment in DotNetNuke? If so, how do I get to it? Thanks. *bump* Same problem here.  Installed, welcome page, and instructions to change admin password.  No admin tabs, Host tabs or otherwise visible. Zone Alarm is turned off (but installed), clear...

How to check if some user is in the role
Hi,I want to build Administration panel in which I could controll which users are in selected role. I'm writing it in ASP MVC, but it doesn't matter. First I'm checking is edited/managed role exist (if no I'm writing message): if (Roles.RoleExists(roleName)){ ViewData["Title"] = "Manage users in role: " +roleName; ViewData["roleName"] = roleName; MembershipUserCollection users = Membership.GetAllUsers(); return View(users);}  and in the view I want to show list of all users with checkbox indicating if user is in selected role. ...

Getting Start With .net
hi i'm intersted to learn asp.net (vb or delphi) . i programming with delphi6 but i'd like to tp know something about programming in internet specially with .net . i hear about microsoft.net with delphi 7 that i can programming with delphi in .net .... is it right ? what 's our opinian about it ? and better to learn Vb.Net or continu with delphi(or delphi.net) thanks. Ali Darabian I think there is some support for Delphi in .Net. However, you will find much more support from the user community if you choose a more popular language such as VB.Net or C#. Since your al...

Manage Users For This Role / Manage Roles For This User Question
In the roles/user management pages there is a link called Manage Users For This Role and Manage Roles For This User respectively. I want non Admins to be able to see these pages, and currently I have it so that they can see the manage users and manage roles pages. However, when a non admin clicks on Manage Users For This Role or Manage Roles For This User link it does not display the control, just an empty page. I can get around this by giving edit rights to the page, but I do not want them to have edit rights for the page. Any ideas? Thanks  ...

Where to start and how did you get started?
Hi, I have had a feeling for a long time to jump into the adds market for some time due to my low income (shooting for the stars) and I don't have anything better to do these days. But I find it really difficult not to give up due to lack of guides (what I can find atleast) and all the hard words which only makes me confused. But I won't give up. Never. Not sure if this is the right place to post this, but I deffinitly would be really greatfull for help getting started. How did you get started? +If there are any teacher that wanna show me the ropes private, I can give payment with ...

get error Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.
Hi,my interaction with database is completely lost. I cannot even open database and view tablesI get error Failed to generate a user instance of SQL Server due to a failure in starting the process for the user instance. The connection will be closed.I am using VS 2005  Error log: SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required.2008-09-07 13:10:03.51 Server      Detected 1 CPUs. This is an informational message; no user action is required.2008-09-07 13:10:28.40 Server   &...

Web resources about - Check user role - asp.net.dotnetnuke-get-started

Check the Weather
provides weather data across the globe. From Timbuktu to Istanbul, wherever you end up you’ll always know what it’s like outside.

Check Point - Wikipedia, the free encyclopedia
Check Point Software Technologies Ltd. is an international provider of software and combined hardware and software products for IT security , ...

Facebook Reminds Page Admins to Check Their Post Attribution Settings
Facebook page administrators are seeing pop-up messages reminding them to “change attribution settings” and ensure that they are posting as their ...

"Trump Fear Stalks Davos as Elite Pray for Spring Reality Check."
Fabulous headline at Bloomberg. Excerpt: The prospect of Trump in the White House is ratcheting up anxiety among the 2,500 business and political ...

Lynch Defends Legality of Plans to Tighten Gun Buyer Checks
U.S. Attorney General Loretta Lynch defended the Obama administration’s plans to expand background checks on firearms purchases as lawful and ...

Check out all the Italian cars you can buy in the US in 2016
"The next wave of Italians has come to America," a 2010 commercial for the Fiat 500 proclaimed . Brightly-colored examples of the itty-bitty ...

Fact check: Clinton slams Sanders on bank votes
In Sunday night debate, Democratic front runner seeks to deflect against attacks that she is too cozy with Wall Street

FBI: Gun check's 'perfect storm'
The surge of background checks has forced the FBI to temporarily halt the processing of appeals from buyers whose purchase attempts were denied. ...

Paws and check out how cute this game is
It’s been a while since we’ve seen a game that looked as simultaneously adorable and mysterious as Paws, but here it is. The upcoming title, ...

Lynch: DOJ Performed Record High 3 Million Background Checks In December
'Highest number of monthly requests since after the Sandy Hook shooting massacre in December 2012'

Resources last updated: 1/22/2016 9:23:32 AM