473,383 Members | 1,846 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

ArgumentException when call WindowsPrincipal.IsInRole

I receive multiple (handled) ArgumentExceptions when I call
WindowsPrinciple.IsInRole. The exception text is:

A first chance exception of type 'System.ArgumentException' occurred in
mscorlib.dll

Additional information: Item has already been added.
Key in dictionary: "DOMAINNAME\userGroup"
Key being added: "DOMAINNAME\userGroup"

where DOMAIN is the domain of the group I am querying for, and userGroup
seems to be each group in the domain (which is large).

My code is as follows:

//this is called when the application first starts
AppDomain.CurrentDomain.SetPrincipalPolicy(Princip alPolicy.WindowsPrincipal);

public static bool UserIsInRole(string roleName)
{
WindowsPrincipal principal = (WindowsPrincipal)Thread.CurrentPrincipal;
return principal.IsInRole(roleName);
}

The exceptions are handled, as I am only notified when I turn on the break
on all exceptions IDE option. I am using framework 1.1.

This isn't a problem as such, I am just wondering if anyone else has
experienced this.

Thanks
Dan
Nov 16 '05 #1
0 1279

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Nony Buz | last post by:
My objective is simply: Notify a form when a image file has been created in a directory. First there is a basic interface for the callback function: public interface INewImageNotify { void...
0
by: Ffelagund | last post by:
Hello I'm trying to load dinamically some dll's but when I try to invoke one method, I ever get ArgumentException if I'm not using native types. Here are the .h of the dll: #pragma once...
6
by: JIM.H. | last post by:
Hello, username=user.identity.name trueFalse=User.IsInRole("myDomain\Administrators")? First line return user name as administrator but second line returns false? What might be the reason? Or how...
1
by: Johan Johansson (Sweden) | last post by:
I am writing a webService that is going to be accessed anonymously (I don't want to "configurable" depend on windows integrated authentication). But I still want to authenticate the client (or...
10
by: Bob | last post by:
This a bit of a second post on same subject, my apologies. IsinRole function only works with built-in roles. If I create a new group on my domain controller then add an existing user to that...
2
by: chris | last post by:
Hi, I've developed a Windows Forms Application in Visual Studio 2003. I built an MSI package using the setup and deployment projects setup wizard. I ran the MSI package on my machine (where I...
6
by: =?Utf-8?B?QkJN?= | last post by:
Hi, I have an app that is crashing due to a System.ArgumentException. At this point it's just a simple app to test some basic object values. The main app is a Windows App that looks like...
1
by: =?Utf-8?B?RjVGNUY1?= | last post by:
I use the following function to ascertain if the current user is in ann AD security group. It appears to work, except if the group contains any space characters, it always returns false. For...
1
by: Andy | last post by:
Hi, I currently have my application setup and built using Windows Authentication (WindowsPrincipal). For security checks, I simply do an IsInRole call on the Principal. The role permissions...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.