473,287 Members | 1,413 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,287 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 1877

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: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
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: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
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...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...

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.