473,804 Members | 3,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

IsInRole always false

Hello,
username=user.i dentity.name
trueFalse=User. IsInRole("myDom ain\Administrat ors")?
First line return user name as administrator but second line returns false? What might be the reason? Or how does isInRole work?
Thanks,
Jim.

Nov 18 '05 #1
6 4333
Is username returning a local machine administrator rather than domain
administrator? Since you didn't specify that username is
myDomain\Admini strator, it isn't clear. If the user is a domain
administrator, it should work just like you have it.

Dale Preston
MCAD, MCSE, MCDBA
"JIM.H." <JI**@discussio ns.microsoft.co m> wrote in message
news:B2******** *************** ***********@mic rosoft.com...
Hello,
username=user.i dentity.name
trueFalse=User. IsInRole("myDom ain\Administrat ors")?
First line return user name as administrator but second line returns false? What might be the reason? Or how does isInRole work? Thanks,
Jim.

Nov 18 '05 #2
insert <identity impersonate="tr ue" /> in webconfig
Nov 18 '05 #3
"JIM.H." <JI**@discussio ns.microsoft.co m> wrote in message
news:B2******** *************** ***********@mic rosoft.com...
Hello,
username=user.i dentity.name
trueFalse=User. IsInRole("myDom ain\Administrat ors")?
First line return user name as administrator but second line returns

false? What might be the reason? Or how does isInRole work?

If you are programming in C#, then I think you need to escape the "\". Try
User.IsInRole(" myDomain\\Admin istrators").
--
John Saunders
johnwsaundersii i at hotmail
Nov 18 '05 #4
Duh.... Good eye!
"John Saunders" <jo************ **@notcoldmail. com> wrote in message
news:OE******** ******@TK2MSFTN GP12.phx.gbl...
"JIM.H." <JI**@discussio ns.microsoft.co m> wrote in message
news:B2******** *************** ***********@mic rosoft.com...
Hello,
username=user.i dentity.name
trueFalse=User. IsInRole("myDom ain\Administrat ors")?
First line return user name as administrator but second line returns

false? What might be the reason? Or how does isInRole work?

If you are programming in C#, then I think you need to escape the "\". Try
User.IsInRole(" myDomain\\Admin istrators").
--
John Saunders
johnwsaundersii i at hotmail

Nov 18 '05 #5
"JIM.H." <JI**@discussio ns.microsoft.co m> wrote in message
news:C3******** *************** ***********@mic rosoft.com...
Hi Dale,
User.Identity.N ame returns "myDomain\myUse ranme"
but both User.IsInRole(" MyDomain\Admini strator") and User.IsInRole(" BUILTIN\Adminis trator") returns false any Idea?
Did you try doubling the "\"?
--
John Saunders
johnwsaundersii i at hotmail

"Dale" wrote:
Is username returning a local machine administrator rather than domain
administrator? Since you didn't specify that username is
myDomain\Admini strator, it isn't clear. If the user is a domain
administrator, it should work just like you have it.

Dale Preston
MCAD, MCSE, MCDBA
"JIM.H." <JI**@discussio ns.microsoft.co m> wrote in message
news:B2******** *************** ***********@mic rosoft.com...
Hello,
username=user.i dentity.name
trueFalse=User. IsInRole("myDom ain\Administrat ors")?
First line return user name as administrator but second line returns

false? What might be the reason? Or how does isInRole work?
Thanks,
Jim.


Nov 18 '05 #6
"John Saunders" <jo************ **@notcoldmail. com> wrote in message
news:eW******** ******@TK2MSFTN GP09.phx.gbl...
"JIM.H." <JI**@discussio ns.microsoft.co m> wrote in message
news:C3******** *************** ***********@mic rosoft.com...
Hi Dale,
User.Identity.N ame returns "myDomain\myUse ranme"
but both User.IsInRole(" MyDomain\Admini strator") and

User.IsInRole(" BUILTIN\Adminis trator") returns false
any Idea?


Did you try doubling the "\"?


Sorry, didn't notice you were using VB.NET until after I posted this.
--
John Saunders
johnwsaundersii i at hotmail
Nov 18 '05 #7

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

Similar topics

0
1366
by: Kevin | last post by:
Hello all, I'm unable to get the IsInRole method to work with my AD domain. There is a global group that I am a member of, when I query that group using the IsInRole method, it returns false. One question that I had, is there anything different that has to be done with AD when using this method? For example, I'm populating a list box with the members of this group, and when I attach using LDAP I had to use...
2
2287
by: Mong | last post by:
Hi all, Well I reckon I've just read through 200 messages on this subject and tried every combination of every setting the is and I'm still getting a return of false on IsInRole. Here's my code: Dim rolUI_Admin as String Dim wp As WindowsPrincipal rolUI_Admin = "DOMAIN/DOM_ACL_TestAdmins"
0
1012
by: Peter | last post by:
Hello! I have a strange problem with .IsInRole method. When I use this method on my development machine everything works fine. However when I deploy my application on a production server this method does not work correct. I use the following code: String DefaultAdminRole = @"dom\admgroup"; String UserName="";
2
3240
by: Dave | last post by:
Hi, I'm testing the IsInRole method on my app. I'm using Integrated security so I'm not sure if that has something to do with it. I have a groups table which I want to secure certain portions of my application. In the global.asax: protected void Application_AcquireRequestState(Object sender, EventArgs e) {
8
13157
by: Oliver Rainer | last post by:
Hi, I have the following problem... Pre-requisites: Installation of an Asp.net webservice on a IIS5 server (win2k). Anonymous access is not allowed, only using windows authentication (intranet app), webmethoda are using the Principalpermssion attribute () for identification. Result --> does not work
4
4427
by: Bob | last post by:
I created a usergroup on my W2K AD domain server and called it MyCustomRole I added my user to it named User Name fully qualified is Mydomain\Bob I can see that My.user.name Is OK its Mydomain\Bob But when I run the line If My.User.IsInRole("MyCustomRole") Then it returns false.
10
7038
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 group, user bob, group TestUsers and then try to determine if My.user.Isinrole("TestUsers") I always get a false, which is incorrect. If I put Bob as part of Administrators or any other built-in group on the DC and look at...
1
1331
by: =?Utf-8?B?dmluZWV0YmF0dGE=?= | last post by:
Hi, I created a local group on server and added my self to that group. I am using the following code in my web page to check the membership of the loggedin user against the Windows group on the same server. User.IsInRole(@'MachineName\groupName') . The above always return me false. If i restart my machine then this returns true. Any clue why?
1
3642
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 example I am a member of groups "NWDeveloper" and "IT Development" if I call the function CurrentUserInRole(@"DOMAIN\NWDeveloper"); it returns true, however CurrentUserInRole(@"DOMAIN\IT Development"); it returns false. I need to be able to...
0
9705
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9575
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10564
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9134
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7609
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6846
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2981
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.