.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Role manager GetRolesByUserName()

Posted By:      Posted Date: October 08, 2010    Points: 0   Category :ASP.Net

 hi everyone


i have implemented  .net security ( by ASP.NET Web Site Administration Tool)

now i have to  know  the logged in   user name and  role  .

for user name



thts  working  :)


but what to  do to  find out the current user  role ???



please reply  fast


View Complete Post

More Related Resource Links

Authorize It: Use Role-Based Security in Your Middle Tier .NET Apps with Authorization Manager


Authorization Manager in Windows Server 2003 represents a significant improvement in the administration of role-based security, making it more scalable, flexible, and easier to implement. Using Authorization Manager, you can define roles and the tasks those roles can perform. You can nest roles to inherit characteristics from other roles, and you can define application groups. In addition, Authorization Manager lets you use scripts to modify permissions dynamically, and it allows you to wrap your security logic in a security policy that can be stored in Active Directory. Authorization Manager also includes an easy-to-use API for running access checks. The author discusses all of these topics and demonstrates them with a working sample.

Keith Brown

MSDN Magazine November 2003

Large amount of handles of type token using role manager and authorisation manager (azman)

First you'll need some background on the application.  ASP.net application using .net framework 3.5. Security to the application is controlled with impersonation, using a role manager connecting to an azman store which uses Active Directory groups for security. As demoed in the following msdn link ... http://msdn.microsoft.com/en-us/library/ff649313.aspxAfter 50 or so users access the application throughout the day, eventually the application stops responding or users start to experience images not displaying etc and the application pool has to be recycled (typical symptoms of the server running out of memory).  Looking at the application memory usage and available memory on the server this does not appear to be the issue, investigations so far have lead me to think this is to do with Security Token Handles.  I've used process explorer to monitor the asp.net application and handles for the application steadily increase with every page that is accessed and eventually hit 38,000 this is when the application dies.  I've read various links saying that applications should use between 2,000-10,000 handles and any number near 40,000 makes the application unusable (this is the exact behaviour we are experiencing).  Using process explorer and handle.exe from the windows sysinternals site I

custom role manager, type error in Web.config

Hello everybody.I am developping a role provider for AD.I have copy in the root directory of my project in VS2010 the file MyAdamRoleProvider.vb which is an example of a book.I have declared in my web.config the role provider like this: <connectionStrings> <add name="ADService" connectionString="LDAP://webcubedev/OU=webcube,DC=wcdev,DC=local"/> <add name="ADServiceRole" connectionString="LDAP://webcubedev/OU=webcube,DC=wcdev,DC=local"/> </connectionStrings> <system.web> <roleManager enabled="true" defaultProvider="ActiveDirRP"> <providers> <add name="AspNetActiveDirectoryMembershipProvider" type="MyAdamRoleProvider" connectionStringName="ADService" connectionStringRoleName="ADServiceRole" /> </providers> </roleManager> When I debug, the error is "Impossible de charger le type 'MyAdamRoleProvider'"In english : "can't load 'MyAdamRoleProvider' type"I don't see what is wrong, can you help me?

Authorization Manager (AzMan) as role provider with Windows integrated authentication in SharePoint


Hi all,

First I will describe my environment: Windows Server 2008 R2 x64, IIS 7, SQL Server 2008 and MOSS 2007 Enterprise Edition SP2 x64.

I am trying to setup SharePoint 2007 portal to use Windows integrated authentication with Authorization Manager (AzMan) as role provider.

I have set up an authorization store and defined a set of roles in there. Further I configured the web.configs of my SharePoint environment to use AzMan as role provider.

In IIS I see the roles appearing, but unfortunately those roles are not available in my SharePoint portal. I also see notification in IIS stating that Forms authentication has to be used

What should I do to configure it correctly? Is it even possible to use AzMan with Windows authentication in SharePoint 2007?

Thanks in advance.

With kind regards,




Role Manager not working



Im using Visual Web Developer 2010, the roles work ok when run locally but when published they dont seem to work at all.

Can someone please point out what I need to change, everything else works ok. I can log in and add records.

Here is the config.

<?xml version="1.0"?>
  For more information on how to configure your ASP.NET application, please visit

<add key="ChartImageHandler" value="storage=file;timeout=20;" />

        <add name="ApplicationServices" connectionString="Data Source=xxxx;Initial Catalog= ASPNETdb;Persist Security Info=True;User=ASPNETdb;Password=xxxx;" providerName="System.Data.SqlClient"/>
        <add name="PODPortalConnectionString" connectionString="Data Source=xxxx;Initial Catalog= ASPNETdb;Persist Security Info=True;User=ASPNETdb;Password=xxxx;" providerName="System.Data.SqlClient"/>
        <add name="ASPNETDBConnectionS

Problem making Role based Menu in MVC application



 I want to make Rolebase menu in MVC such that if user doesnot have permission for some action then that Action name shouldnot be shown in the Menu.

 I have used the code in the url(http://forums.asp.net/t/1566328.aspx) in my MVC application.My application is a Discussion Forum(in MVC) same functionality as in this forum forums.asp.net

 I have used Controllers for post, thread etc.In each controller there are some actions that are using [Authorize(Roles)] attribute

 but this coding does not count  those Actions in Controllers having Authorize attribute according to the url http://forums.asp.net/t/1566328.aspx 

 In the code, Authorize attribute is applied to Controller class, but my requirement is of Applying Authorize attribute to some actions in controller so that some are available for all users and  some links are available rolewise.Now what is the solution for that?



browser gives jibberish when State manager (sql) is turned on


Hi all, we're testing our web app with a state manager so that we can do distributed rollouts. We're not getting any errors, but we are getting jibberish returned for every page request. 

(it won't even let me paste it in here)

HOw do I get it to serve the pages normally?


Getting users list reporting to manager from LDAP


Dear All,

I need to get list of users reporting to a particular manager from the Active directory.

In the active directory there is manager property with contains the data in the following way.


Please help me in building the filter condition.

I am using the following

pUserName="Gegore Lid";

strSearch = "(&(objectClass=user)(objectCategory=user)((Manager cn=" + pUserName + "))";

DirectorySearcher dSearcher = new DirectorySearcher(dEntry, strSearch);

            //Account properites to load
            string[] arrPropertiesToLoad = { "displayName", "department", "manager", "sAMAccountName", "EmployeeNumber", "Title" };

          SearchResultCollection sResultColl = dSearcher.FindAll();

 the above code is not returning any result.

Please help me in this.



Getting list of users reporting from specific Manager from Active Directory


Dear All,

I am have requirement like displaying all the user information reporting to specific manager from Active Directory.

Please help me regarding this.



Test-Driven Design: Using Mocks And Tests To Design Role-Based Objects


Use Test-Driven Development with mock objects to design object oriented code in terms of roles and responsibilities, not categorization of objects into class hierarchies.

Isaiah Perumalla

MSDN Magazine June 2009

Going Places: How Connection Manager Connects


Marcus Perryman explains the correct use of Connection Manager when a Windows Mobile application requires network data.

Marcus Perryman

MSDN Magazine December 2008

Patterns in Practice: Object Role Stereotypes


Object role stereotypes can help you better understand and clarify the responsibilities of the objects in your application.

Jeremy Miller

MSDN Magazine August 2008

Aero Glass: Create Special Effects With The Desktop Window Manager


In this article we introduce the Desktop Window Manager, the new interface that manages how windows are rendered on the Windows Vista desktop.

Ron Fosner

MSDN Magazine April 2007

.NET Matters: Restart Manager and Generic Method Compilation


This month Stephen Toub answers questions pertaining to the Windows Vista Restart Manager API and generic method compilation.

Stephen Toub

MSDN Magazine April 2007

Talking To.: Don Box Discusses Web Services and His New Role at Microsoft


Don Box has long been the preeminent expert on COM, as well as one of the creators of the SOAP protocol. He has written numerous books and articles including Essential COM (Addison-Wesley, 1997) and Essential .

MSDN Magazine December 2002

Security: Unify the Role-Based Security Models for Enterprise and Application Domains with .NET


Role-based security allows administrators to assign access permissions to users based on the roles they play rather than on their individual identities. These privileges can be used to control access to objects and methods, and are easier to identify and maintain than user-based security. The .NET Framework provides two role-based security models, which are exposed as two namespaces: System.Enterprise-Services and System.Security.Permissions. Presented here is a comparison of the two options and a discussion of when each is the right choice. The author also demonstrates the process involved in setting up access security and discusses role memberships.

Juval Lowy

MSDN Magazine May 2002

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend