Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

User.IsInRole("Domain\Administrators") Error

Status
Not open for further replies.

Glowworm27

Programmer
May 30, 2003
587
US
Arrrrgggggg......
ASP.NET --
Hi all, I got a bug in the VS.net IDE that is troubling me.

I am trying to determine if the user is in a group in the domain. I am using the User.IsInRole("Domain\Administrators") method to check if the user is a member of the Domain administrators group.

The problem I keep getting is, when I run the code in design mode, I receive an error ->

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

Additional information: Item has already been added. Key in dictionary:"Domain\Administrators" Key being added: "Domain\Administrators"

<- if I continue the code execution it will return true becasue I am a member of the administraors and works as I had hoped. My question is how do I get rid of the design time error? or am I doing something wrong?

I will include some code for you to see....

-------------------CODE-----------------------------

Imports System.DirectoryServices
Imports System.Web.HttpContext

Public Class multipage

Inherits System.Web.UI.Page


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

lblStatus.Text = System.Web.HttpContext.Current.User.Identity.Name


Try
If (HttpContext.Current.User.IsInRole(&quot;TIRESPLUS\ISGRP&quot;)) Then
lblStatus.Text &= &quot; user is in ISGroup&quot;
End If
Catch ex As Exception
lblStatus.Text = ex.Message
End Try

------------------- Code stopped for brevity ----------
The designer throw the error when tring to execute the IF statement, however no execption is ever thrown...???

oh , running windows 2000 pro, Visual Studio.net 2003 professional not sure of any service patches installed.


Please help
Thanks




George Oakes
Goakes@TiresPlus.com = Programmer
George@1-Specialday.com = Mobile DJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top