Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Security > Configuring ActiveDirectoryMembershipProvider

Reply
Thread Tools

Configuring ActiveDirectoryMembershipProvider

 
 
anbaesivam
Guest
Posts: n/a
 
      02-17-2009
Hi,

I am new to ASP.NET. I am developing a web application using ASP.NET and I
want to use ActiveDirectoryMemberhipProvider in my form authentication. In
this provider, I need to specify the <connectionstring> and <membership>
information to be hardcoded with the domain name, user name and password in
the Web.config file. But in the production, my application can be installed
in any domain. So, is it possible to configure
ActiveDirectoryMembershipProvider at runtime?. If any tutorial/sample
provided is highly appreciated.

Thanks in advance.
 
Reply With Quote
 
 
 
 
Allen Chen [MSFT]
Guest
Posts: n/a
 
      02-17-2009
Hi,

My name is Allen Chen. It's my pleasure to work with you on this issue.

As to this problem, the general way we'll do is to edit the settings in the
web.config after publishing the site. It's easy to do so and we only have
to do that once.

If you want to create UI for the administrator to edit the web.config file
you can try the following code:

Configuration config =
WebConfigurationManager.OpenWebConfiguration(Conte xt.Request.ApplicationPath
);
//Edit ConnectionStringsSection
ConnectionStringsSection css =
(ConnectionStringsSection)config.GetSection("conne ctionStrings");
if (css != null &&
!css.SectionInformation.IsProtected) {
//Here ADConnectionString is the connection string. It
may vary in your case.

css.ConnectionStrings["ADConnectionString"].ConnectionString =
@"LDAP://your connection string";
}
//Edit MembershipSection:
MembershipSection section =
(MembershipSection)config.GetSection("system.web/membership");
if (section != null &&
!section.SectionInformation.IsProtected)
{
//Here section.Providers[1] is
ActiveDirectoryMembershipProvider. It may vary in your case.
section.Providers[1].Parameters["attributeMapUsername"] =
"sAMAccountName";

}
config.Save();

If you have additional questions please feel free to ask.

Regards,
Allen Chen
Microsoft Online 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:
http://www.velocityreviews.com/forums/(E-Mail Removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subs.../aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

 
Reply With Quote
 
 
 
 
Allen Chen [MSFT]
Guest
Posts: n/a
 
      02-20-2009
Hi,

Have you solved this issue?

Regards,
Allen Chen
Microsoft Online Community Support

 
Reply With Quote
 
anbaesivam
Guest
Posts: n/a
 
      02-20-2009
Thanks. I solved the issue.

"Allen Chen [MSFT]" wrote:

> Hi,
>
> Have you solved this issue?
>
> Regards,
> Allen Chen
> Microsoft Online Community Support
>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ActiveDirectoryMembershipProvider Object Reference not set ... =?Utf-8?B?SkQgUWl4Y2xl?= ASP .Net 2 06-08-2006 11:40 PM
Membership credential verification failed With ActiveDirectoryMembershipProvider moi ASP .Net 1 04-21-2006 05:05 PM
user schema change for ActiveDirectoryMembershipProvider steven@sbcanada.com ASP .Net 0 11-01-2005 09:25 PM
ActiveDirectoryMembershipProvider ASP.NET 2.0 Arnel ASP .Net 3 10-31-2005 06:02 AM
ActiveDirectoryMembershipProvider login always fail Natan Vivo ASP .Net 1 10-31-2005 02:43 AM



Advertisments