How to show domain name and user name ("domainname/username") in ASP.NET Web Site Administration Tool while using active directory membership povider?
RSS
This way, I can view users in my active directory and then associate them with application roles I've created by using ASP.NET Web Site Administration Tool. However, since I use Windows authentication, I'm encountering a problem. User names in listed ASP.NET
Web Site Administration Tool does not include my domain name (only "haris" instead of "mydomain/haris"). Because of this, since the user name passed by IIS includes my domain name ("mydomain/haris"), the authenctication is always fail. How to show domain name and
user name ("domainname/username") in ASP.NET Web Site Administration Tool while using active directory membership povider?
What I'm trying to do is to map Windows login names with my own custom roles. I don't want to use a login page for a better user convenience, so I just use Windows authentication. This means user names passed to my application is in <domain_name>/<user_name>
format.
I know I can manage roles and membership easily by using the ASP.NET Web Site Administration Tool. I don't want to create my own custom adiministration tool if I don't have to. With a little trick, I can link the ASP.NET Administration Tool to my active
directory. This way I can map the active directory names with my own custom roles that I created with the administration tool. However, the user names listed in the administration tool don't include my domain name but only the Windows login name (only <user_name>,
not <domain_name>/<user_name>). So, eventhough I "can" map those names with my roles, the authentication is always fail, because user names passed to my application is in <domain_name>/<user_name> format, as I said earlier.
Do you know the trick so the administration tool shows user names in <domain_name>/<user_name> format? Or, how to omit domain name from user name passed to my application?
Oh, I just realized that I have used a wrong title for this topic since I think the problem has nothing to do with active directory membership provider... is it? [:P]
I don't want to use a login page for a better user convenience, so I just use Windows authentication.
Since you have set Windows Authentication, even though you have active directory provider setup but it is not used when you login. So definitely you will get in <domain_name>/<user_name> format.
Now the link in previous post shows how you can use SqlRoleProvider with Windows Authentication. I doubt you will be able to use WAT for that.
One question? Are you having different roles than Windows Groups /AD roles or they are the same? i.e. is it necessary for you to use SqlRoleProvider ?
haris101
Member
269 Points
188 Posts
How to show domain name and user name ("domainname/username") in ASP.NET Web Site Administration ...
Oct 20, 2008 02:40 AM|LINK
Hi,
I'm using active directory membership provider and SQL role provider in my web application by adding these lines in my web.config file:
This way, I can view users in my active directory and then associate them with application roles I've created by using ASP.NET Web Site Administration Tool. However, since I use Windows authentication, I'm encountering a problem. User names in listed ASP.NET Web Site Administration Tool does not include my domain name (only "haris" instead of "mydomain/haris"). Because of this, since the user name passed by IIS includes my domain name ("mydomain/haris"), the authenctication is always fail. How to show domain name and user name ("domainname/username") in ASP.NET Web Site Administration Tool while using active directory membership povider?
Thanks in advance,
Haris
guru_sarkar
All-Star
22198 Points
3463 Posts
Re: How to show domain name and user name ("domainname/username") in ASP.NET Web Site Administrat...
Oct 20, 2008 06:15 PM|LINK
The format of the user name depends on the attributeMapUsername attribute of the <membership> element.
Check here: http://msdn.microsoft.com/en-us/library/ms998360.aspx
although it won't store in domainname/username format.
But I don't get it why it is not authenticating ?
Is your forms authentication set correctly?
I don't see your role manager provider settings?
check this: http://weblogs.asp.net/scottgu/pages/Recipe_3A00_-Implementing-Role_2D00_Based-Security-with-ASP.NET-2.0-using-Windows-Authentication-and-SQL-Server.aspx
haris101
Member
269 Points
188 Posts
Re: How to show domain name and user name ("domainname/username") in ASP.NET Web Site Administrat...
Oct 21, 2008 02:31 AM|LINK
Sorry, I forgot to attach my role manager provider settings. Below is it.
What I'm trying to do is to map Windows login names with my own custom roles. I don't want to use a login page for a better user convenience, so I just use Windows authentication. This means user names passed to my application is in <domain_name>/<user_name> format.
I know I can manage roles and membership easily by using the ASP.NET Web Site Administration Tool. I don't want to create my own custom adiministration tool if I don't have to. With a little trick, I can link the ASP.NET Administration Tool to my active directory. This way I can map the active directory names with my own custom roles that I created with the administration tool. However, the user names listed in the administration tool don't include my domain name but only the Windows login name (only <user_name>, not <domain_name>/<user_name>). So, eventhough I "can" map those names with my roles, the authentication is always fail, because user names passed to my application is in <domain_name>/<user_name> format, as I said earlier.
Do you know the trick so the administration tool shows user names in <domain_name>/<user_name> format? Or, how to omit domain name from user name passed to my application?
Many thanks in advance,
Haris
haris101
Member
269 Points
188 Posts
Re: How to show domain name and user name ("domainname/username") in ASP.NET Web Site Administrat...
Oct 21, 2008 02:41 AM|LINK
Oh, I just realized that I have used a wrong title for this topic since I think the problem has nothing to do with active directory membership provider... is it? [:P]
guru_sarkar
All-Star
22198 Points
3463 Posts
Re: How to show domain name and user name ("domainname/username") in ASP.NET Web Site Administrat...
Oct 21, 2008 03:52 PM|LINK
Since you have set Windows Authentication, even though you have active directory provider setup but it is not used when you login. So definitely you will get in <domain_name>/<user_name> format.
Now the link in previous post shows how you can use SqlRoleProvider with Windows Authentication. I doubt you will be able to use WAT for that.
One question? Are you having different roles than Windows Groups /AD roles or they are the same? i.e. is it necessary for you to use SqlRoleProvider ?
If No then check 'Configuring URL Authorization' - here: http://msdn.microsoft.com/en-us/library/ms998358.aspx