I did this with osMemberControl (osmembercontrols.codeplex.com) maybe you could download the source and use the bits you need? Look in the MemberRegistration.cs file.
Hi Anthony, I solved this by applying some code in the login action (code behind). This should do what you need until the circular reference issue has been solved:
// at this point the user should be logged in Member m = Member.GetMemberFromLoginNameAndPassword(unameTB.Text, passwordTB.Text); MemberDB memberDb = new MemberDB(); StaticMember sm = memberDb.GetMemberDetails(m.Id.ToString());
// First, check to see if the user is active and that he is not expired if (sm.IsActive!=1) { Response.Redirect("/logout.aspx?active=0"); // this is where I call the logout action in order to kill the user session...a little hacky but it works }
// check if the user has expired ans set appropriately... if (sm.MembershipTerm.IndexOf("Free")==-1) { DateTime now = DateTime.Now; if (sm.ExpirationDate.CompareTo(now) < 0) { // the account is expired so set the session as such... SessionHandler.IsExpired = "true"; } } }
Hi Anthony, this method has no problems within the context of the supplied membership provider. The error (at least for me) that you are experiencing happens when trying to extend that provider and override the validate method. Are you seeing the circular reference behaviou even in your code-behind?
circular referenc Member.GetMemberFromLoginNameAndPassword
I'm getting a circular reference error when i use
Member.GetMemberFromLoginNameAndPassword(username, password)
This is odd, as it was working and i can't put my finger on what has changed.
I've read that a similar post here. I tried the standard asp,net
Membership.ValidateUser(username, password);
But that seemed create the same error. Any feed back would be much appreciated. I just need a way to log users in.
anthony
Member memberFromLoginNameAndPassword = Member.GetMemberFromLoginNameAndPassword(username, password);
if (memberFromLoginNameAndPassword != null)
{
Member.AddMemberToCache(memberFromLoginNameAndPassword, m_useSession, new TimeSpan(0, m_timeout, 0));
}
You can just use the asp.net member login control <asp:login />
Actually i should add some more info.
I have the following fields in my usercontrol.
username | password | Email | Address1 | Address 2 | Custom etc
I'm saving this extra info as member nodes.
m = Member.GetMemberFromLoginName(memberLogin);
m.getProperty("address1") = "etc";
I did this with osMemberControl (osmembercontrols.codeplex.com) maybe you could download the source and use the bits you need? Look in the MemberRegistration.cs file.
any further thoughts in this. How do i validate a user login.It seems the following method doesn't seem to work in 4.0.2.1
Member.GetMemberFromLoginNameAndPassword(username, password)
Hi Anthony, I solved this by applying some code in the login action (code behind). This should do what you need until the circular reference issue has been solved:
Hope this helps.
-- Nik
hi nik , i saw your solution. Does this only work on Login Control or can i use this on normal onclick event.
I was puzzle why your method worked. ie when i hit GetMemberFromLoginNameAndPassword that is when the error happens.
Thanks for your reply, this is driven me crazy.
Hi Anthony, this method has no problems within the context of the supplied membership provider. The error (at least for me) that you are experiencing happens when trying to extend that provider and override the validate method. Are you seeing the circular reference behaviou even in your code-behind?
-- Nik
is working on a reply...
This forum is in read-only mode while we transition to the new forum.
You can continue this topic on the new forum by tapping the "Continue discussion" link below.