473,322 Members | 1,431 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

updating ActiveDirectoryMembershipProvider settings at runtime

Hi,

I am using the membership provider class, "System.Web.Security.ActiveDirectoryMembershipProv ider".
I am using Login Server control and attaching the already configured "ActiveDirectoryMembershipProvider" in the web.config file. But my restriction is that I do not want to give the "connectionUsername" and "connectionPassword" in the web.config file.

I want to update this 2 attributes at runtime in the Login1_LoggingIn event handler, so that the user will be able to authenticated with his login credentials only, provided the user inputs a valid & correct domain user name & password.

I see that when I set the MembershipProvider property of the Login1 server control, it picks up the settings only from the web.config file and not the runtime-updated values.

How could I achive this?

Below is the code snippet, where I am stucked..

_______________
ad = new ActiveDirectoryMembershipProvider();
NameValueCollection configNameValueCollection = new NameValueCollection();
string sDomainUserName = WebConfigurationManager.AppSettings["DomainName"] + "\\" + Login1.UserName;
// "DomainName" is one app setting which stores the actual domain name.
configNameValueCollection.Add("connectionUsername" , sDomainUserName);
configNameValueCollection.Add("connectionPassword" , Login1.Password);
configNameValueCollection.Add("attributeMapUsernam e", "sAMAccountName");
configNameValueCollection.Add("connectionStringNam e", "DomainConnectionString");

ad.Initialize("DomainADMembershipProvider", configNameValueCollection);
// Here "DomainADMembershipProvider" is the same name as specified in web.config file.
Login1.MembershipProvider = ad.Name;

_______________

Let me know if this is possible..
Thanks,
Parag.
May 12 '06 #1
0 1880

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

Similar topics

1
by: Natan Vivo | last post by:
Hi. I'm tring to implement AD login with .net beta2 here. I am using asp:Login control, but the Login always fails. I tried to validate manually using Membership.ValidateUser("domain\user",...
0
by: Rik Brooks | last post by:
I am trying to write a change password routine using the new ActiveDirectoryMembershipProvider. My code is below. I'm getting an exception saying that my ActiveDirectoryMembershipProvider has not...
2
by: JD Qixcle | last post by:
I have been following several threads between David Thielen and Luke Zhang regarding the ActiveDirectoryMembershipProvider as used for ASP.NET 2.0 Forms authentication, but I receive a slighly...
18
by: Glenn Eastlack | last post by:
I have been trying to use ASP.NET 2.0 built-in Membership Providers. Particularly the ActiveDirectoryMembershipProvider. My web.config looks like this: <connectionStrings> <clear/> <add ...
0
by: Nehpets | last post by:
I'm trying to setup a web site that uses active directory for user authentication under asp.net 2.0. For testing, I have separately installed two virtual servers. The first is a domain...
0
by: mannyl | last post by:
Hopefully one of you have worked with the .net 2.0 ActiveDirectoryMembershipProvider or some varient they of. please reply to rnbergren@dmacc.edu What I want to reference is the resetpassword...
0
by: davemills81 | last post by:
Hi, Does anyone know how to update the user or application settings of a dll after building? The problem I have is? I have recently developed a service in C# that attaches references a dll. ...
0
by: zeplynne | last post by:
Having trouble using ActiveDirectoryMembershipProvider with one specific website. When attempting to login to the site, after a long period of time (about 2 - 3 minutes), "Server Application...
3
by: rroden | last post by:
C:\WINDOWS\assembly \WindowsSystem.Web.Security.ActiveDirectoryMembershipProvider isn't being installed with .net 2.0 or 3.0 on any of my systems. What am I doing wrong?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.