RE: ActiveDirectory and user page Access



I have been looking at the options for configuring AD membership and looks
like for the role management I found this link:
http://msdn.microsoft.com/en-us/library/ms998336.aspx. It looks very detailed
and I am not how to get around this. Can I just enabled the role manager in
the web.config file and go from there. I used this web.config below and
created a demo app to retrieve the role of the logged on and was not
successful.Any hints

""Hongye Sun [MSFT]"" wrote:

Thanks for your reply, Alex.

Here are my answers:

(1)What does the CN=Users,DC=testdomain1,DC=tes
t,DC=com" mean and do I have to use these attributes
This is the DistinguishedName in ADsPath. It is required if Kerberos
authentication is required in your AD. This is detailed documented at
http://msdn.microsoft.com/en-us/library/aa746384.aspx. You'd better to use
it, because it works in any case of authentication.

(2)Is Is it possible to use text box controls instead of the login
controls
and still user the membership class
The answer is yes. Please use "Membership.ValidateUser(userName.Text,
password.Text)" to do authentication.
Here is sample code for doing the same job with
ActiveDirectoryMembershipProvider. Please follow the "Using the
ActiveDirectoryMembershipProvider" section:
http://msdn.microsoft.com/en-us/library/ms998347.aspx#paght000022_usingtheac
tivedirectorymembershipprovider

(3) Can you give a line of line that will validate the group or role that
the logged in user belongs to. It appears to be similar to validate user
syntax but I am not sure.
Do you mean you want the sample code of validate the group or role that the
logged in user belongs to?
Usually, we use the method: "Roles.IsUserInRole(userName, roleName)" to do
it, which gets a value indicating whether the specified user is in the
specified role. It is documented at
http://msdn.microsoft.com/en-us/library/bz1zy88e.aspx.
Another method is "Roles.GetRolesForUser(userName)", which gets a list of
the roles that a user is in. It is documented at
http://msdn.microsoft.com/en-us/library/8h930x07.aspx.
Another alternative is "User.IsInRole(roleName)". The User is from
System.Web.HttpContext.Current.User. It is documented at
http://msdn.microsoft.com/en-us/library/system.security.principal.iprincipal
.isinrole.aspx.

The roles and groups can be provided by SqlRoleProvider, or
WindowsTokenRoleProvider. That depends on your configuration in web.config.
Again, for SqlRoleProvider, the best sample I ever found is the
step-by-step instruction in Scott Gu's blog in my initial reply.
For WindowsTokenRoleProvider, similiar to SqlRoleProvider. The sample
configuration code is at
http://msdn.microsoft.com/en-us/library/system.web.security.windowstokenrole
provider.aspx.

We understand that there are so many concepts and configurations that you
need to know when implementing this feature. So please feel free to let us
know your questions and it is always our pleasure to work them with you.

Have a nice day!

Regards,
Hongye Sun (hongyes@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxxxxxxxxxx

This posting is provided "AS IS" with no warranties, and confers no rights.









.



Relevant Pages

  • RE: ActiveDirectory and user page Access
    ... because it works in any case of authentication. ... Do you mean you want the sample code of validate the group or role that the ... That depends on your configuration in web.config. ... Again, for SqlRoleProvider, the best sample I ever found is the ...
    (microsoft.public.vsnet.general)
  • Re: How to write code for this XML configuration section?
    ... Professional Numbskull ... "Kevin Spencer" wrote: ... try to find out a way to implement my XML configuration sections. ... (Look for the sample code included) ...
    (microsoft.public.dotnet.framework)
  • Re: How to write code for this XML configuration section?
    ... (Look for the sample code included) ... powerful and strongly-typed Configuration model. ... The bottom-most class is the ConfigurationElement class, ... Show me your certification without works, ...
    (microsoft.public.dotnet.framework)
  • Re: How to write code for this XML configuration section?
    ... try to find out a way to implement my XML configuration sections. ... the documentation for the .Net Framework 2.0 can be found at: ... (Look for the sample code included) ... Show me your certification without works, ...
    (microsoft.public.dotnet.framework)
  • Re: Encrypt connection string - Access denied
    ... Protecting Connection Strings and Other Configuration Information ... The sample code works fine, but it does not work in my web application ... on my local machine or on a test server. ...
    (microsoft.public.dotnet.framework.aspnet.security)

Loading