.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

Check If Member of Group in AD

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :Windows Application



I am using Active Directory authentication for my website and after the user has logged in, they choose division (which is an AD group) and I want to check against that combo box (depend on what they choose) if they have access to that group. Can someone please give me some C# code on how I do this? I googled and I can't find what I am looking for. So if they click on an option in the combo box, that combo box will do postback, and tell them if they have access or not. If they dont' access, the pop up appears again till they choose one where they have access.



View Complete Post

More Related Resource Links

"NT Authority\SYSTEM" is member of Windows Administrators group? How to check it?

I have workgroup Windows XP Pro SP3 with SQL Server 2008 R2 I have read the answer of Satya SKJ in Purpose of "NT AUTHORITY\SYSTEM" login in SQL Server 2005 topic in this forum (*): "Local System account. The name of this account is NT AUTHORITY\System. It is a powerful account that has unrestricted access to all local system resources. It is a member of the Windows Administrators group on the local computer, and is therefore a member of the SQL Server sysadmin fixed server role" Why do not I see "NT Authority\SYSTEM" as a member of Administrators group in my computer (compmgmt.msc ---> System Tools --< Local Users and Groups --> Groups --> administrators)? I see there only  Administrator. How to check and manage the membership of "NT Authority\SYSTEM" (as well as of "NT Authority\Network Service" and "NT Authority\Local Service") in Windows? (*) Update: Now, I found the same phrase it in MS SQL Server 2008 R2 BOL [1] Cited: http://msdn.microsoft.com/en-us/library/ms191543.aspx Selecting an Account for the SQL Server Agent Service (SQL Server 2008 R2)   

CAML query to check if user is member of a specific group


I've got a nested query caml which basically should check 3 things:

  1. Check if a task has been assigned directly to the ucrrent user
  2. Check if a task has been assigned to a group the user is in
  3. Check if the user is member of a specific

The first to bullet points work like a charm, but I can't figure out how to get the last one to work. Here is what I thought should work:

query += "<Where>";
query += "<Eq><Membership Type=\"CurrentUserGroups\">";
query += "<Value Type=\"String\">Name of my specific group</Value>";
query += "</Membership></Eq>";
query += "</Where>";

Somehow it doesn't seem to be the correct approach, is there somebody who can help me out on this? Thanks

How to check effective permissions for a user or group for a SQL server object or whole server?

Guys, How do I see effective permissions for a user or group for a SQL server object or whole server? For example, a user is not listed in security/logins, but he is a member of few groups and some of them have assigned permissions on SQL server (again either directly or through membership in other groups) Even when I select an object (a table), check properties/permission – it doesn’t let me select any principal, except those listed on security/logins… Anyway, what is the right way to see effective permissions for a user or group? Sorry for asking such a simple question, I’ve searched but found nothing relevant.

group member detail view

hi, i have add member group to my detail view. but it does not show the member group correclty. it shows a lot duplicated members. and members that are not in a group it shows that they are in the group. i know you can not modify the wss_conten database. how can i still use group member in dataview?

check user exists in which group

After entering user name, i want check user belonging to which group, group is some thing like role based if group is something group1 , then i want redirect hime to page 1, if groupis 2  then page 2 like that

How to check user is a particular group


How to check user is related to a particular group , if he is assigned to multiple groups

site member group can only open read-only version of the document


Hi there,

According to this video:
more than 1 person can open a word document and edit it at the same time.

When I test it, it doesn't work.
I can open it fine but my colleague can only open a read-only version.
We're both using Office 2010.
I found out that I'm part of OWNER group, while the other guy is just a MEMBER group.

I've checked the permission for MEMBER, it has "contribute" permission, which allow him to edit document library:
<label for="idspnidEditListItems">Edit Items  -  Edit items in lists, edit documents in document libraries, and customize Web Part Pages in document libraries. </label>

If I add him to OWNER group, he can work on it like the one on the video (link above).
Or, I can add individual user and assign DESIGNER role to it.

My question is: why he has to be in the OWNER group (or DESIGNER role)?
since we have many people working on the document but only 1 person to be included in the OWNER group, it's not a good idea to add everyone to OWNER

Check if group is expanded or collapsed



I'm using a matrix with 2 groups: ItemGroup and Item.  InitialState of the Item group is collapsed.

Nothing special till now, but:  What I want to do is show another value when item is collapsed or expanded.

So the value is not just the sum or avg of the item values below, but it is an AVG of another field that only may show up when Item is hidden.


 + A           10

 - A     A1     5  

          A2     2



Anyone a idea on how to pull this off?

Group check boxes

Hi group,
How can I group a couple of check boxes on my form so that only ONE can be checked an anytime?
I've tried placing them onto a panel but I can still check them both.
Using VB.NET

User has access but is not a member of any group


Help!  I have a user that access to all of the content in my site even though he has been restricted for certain lists and for certain items within the list.  

To troubleshoot the issue, I have removed him from all security groups in the site.  He should have no access to anything in the site or any lists.  He can still see the items.  And when I click on a list item and check his permissions, here's what I see.  What do I need to do now?  Where is he getting all these extra permissions?


p.p1 {margin: 5.0px 0.0px 5.0px 0.0px; font: 14.0px 'Times New Roman'} p.p2 {margin: 5.0px 0.0px 5.0px 0.0px; font: 12.0px 'Times New Roman'; min-height: 15.0px} p.p3 {margin: 5.0px 0.0px 5.0px 0.0px; font: 12.0px 'Times New Roman'} table.t1 {border-collapse: collapse} td.td1 {border-style: solid; border-width: 1.0px 1.0px 1.0px 1.0px; border-color: #cbcbcb #cbcbcb #cbcbcb #cbcbcb; padding: 0.0px 5.0px 0.0px 5.0px}

Permission levels given to Matthew (domain\matt) 




The followi

MDX Query runs endless if the User is not a member of the Domain Admin Group


Please, before you say "its not possible" read my post. Myself, i couldnt believe it, until i saw the behaviour with my own eyes.
Environment: SSAS 2005, tested with a MDX Query executed in the SQL Server Management Studio.

We deliver a CUBE (SSAS 2005) that we have build for our Billing System (SQL 2005). Nothing tricky on the cube definition. The cube is installed on several customer systems, runs without a problem. On our in-house test server it runs with no problem. I can execute the same MDX Query connected as a User who is a Member of the Domain Admins and with a User who is a "simple" Domain User. The same query performance, the same Resultset, experienced in-house and by many of our customer.

But on the system of one of our customer i have a really strange behaviour. If i connect on the SQL Management Studio with a User that is in the Domain Admin Role (let's call it user "A") the same MDX Query that we use in-house runs without a problem. But on the customer system i cant execute the MDX Query with a User that is not a Member of the Domain Admin Role (let's call this user "B").
The simple Domain User "B" starts the SQL Management Studio and connects to the Analysis Services Instance. No error. In the SQL Management Studio, on the left pane it has the same metadata, dimensions and members

A member of the Reader SharePoint group on Central Administration.



Sharepoint 2007


Under point 5 of the below document i am not able to perform the action. would any body help me how can i do it ?



how can i add  "A member of the Reader SharePoint group on Central Administration."


Thanks in advance

Any comment will be appreciated ________________________________ Thanks Zahid Haseeb zahidhaseeb.wordpress.com

check if user belongs to a windows group C#

Hello Guys, I have eneed to check if the current windows user is part of a specific windows group say corp\BO. I tried using isinRole but it returns false no matter what.
WindowsPrincipal wp = new WindowsPrincipal(WindowsIdentity.GetCurrent()); 
bool result = wp.IsInRole(@"corp\BO_ops"); 
is there another way of doing this? pls let me know.  I'm stuck with this and could not proceed.

Too many groups/using Active Directory group as a member?



Joined a new organization that just adopted sharepoint. to manage users, they've created three primary groups - SharePoint Owners, SharePoint  Members, and SharePoint Visitors. The SharePoint Visitors group contains only one member - an Active Directory group that contains all of the members of our department. The reson for this is so that when new employees join and old employees leave the Our Department Active Directory group, they automatically are added to the SharePoint group SharePoint Visitors and have access to SharePoint and the appropriate permissions.

People from another Active Directory group (internal customers) are selected individually and placed in their appropriate groups.

Our department is broken down into 27 teams or "Tasks." Each Task has Task Members, Managers and Customers (and SharePoint groups to reflect those). Thus, our department has 81 user groups under it. On the site, all of the user groups except the owners are given limited access, and can only read or contribute on a per Document Library or per Document basis.

In our Task Reports document library, the managers are given contribute status and the employees are given limited status. Employees are only given contribute access to the Task report for their specific task.

Here's a graphical map:

Using a CompareValidator to check input is a valid date

The CompareValidator can do more than just compare two controls. You can also compare it against several of the main .net data types such as Date, Integer, Double and Currency.

To do this you would set Operator="DataTypeCheck" and instead of setting the ControlToCompare or ValueToCompare attributes as you normally would you use the Type="Date" (or any of the data types I have listed above).

Check All with JQuery and a Asp.Net GridView

Display a Grid on the screen with a checkbox in each row. At the bottom of the page have "Check All" button.

Typically if I need to do anything interesting I use a template column. So my GridView will look like the one below (most other columns removed for readability). The only interesting point to note is the CssClass="ApprovalCheckBox" in the CheckBox ItemTemplate.

Problem to group radio button across gridview rows

In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:
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