Glowworm27
Programmer
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("TIRESPLUS\ISGRP"
) Then
lblStatus.Text &= " user is in ISGroup"
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
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"
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("TIRESPLUS\ISGRP"
lblStatus.Text &= " user is in ISGroup"
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