Need some help implementing an member login with ASP.NET login control,
Here is the scenario:
Step 1 a lightbox presents a login formular .
Step 2 when the members is logged on, is presented a disclaimer that upon acceptance redirects him to to the logged in area.
Any help how to achieve this?
Here is the code:
<script runat="server"> void SiteSpecificUserLoggingMethod(string UserName) { // Insert code to record the current date and time // when this user was authenticated at the site. }
I'm not sure you need to record the last login date and time in your method SiteSpecificUserLoggingMethod, as this is normally accessible throughout the site via Membership.GetUser() which will return the current logged in user, which has properties for determining last login, etc. So my guess is you can just redirect to your acceptance page from here.
Then for the acceptance of conditions, I would save a flag (cookie, session, property if it needs to be accecpted only once and not at each login) indicating if the conditions have been accepted or not.
In your logged in area page template(s), I would then make a check in the OnLoad event to make sure the person accessing the page has logged in and has accepted the terms and conditions. So Something like this, if we suppose you save the acceptance flag in the session:
if (Membership.GetUser() == null || !(bool)Session["hasAccpetedConditions"]) Response.Redirect ("~/noAccess.aspx");
2 step member login with ASP.NET login control?
Hi everybody
Need some help implementing an member login with ASP.NET login control,
Here is the scenario:
Step 1 a lightbox presents a login formular .
Step 2 when the members is logged on, is presented a disclaimer that upon acceptance redirects him to to the logged in area.
Any help how to achieve this?
Here is the code:
<script runat="server">
void SiteSpecificUserLoggingMethod(string UserName)
{
// Insert code to record the current date and time
// when this user was authenticated at the site.
}
void OnLoggedIn(object sender, EventArgs e)
{
SiteSpecificUserLoggingMethod(Login1.UserName);
}
bool IsValidEmail(string strIn)
{
// Return true if strIn is in valid e-mail format.
return Regex.IsMatch(strIn, @"^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$");
}
void OnLoggingIn(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e)
{
if (!IsValidEmail(Login1.UserName))
{
Login1.InstructionText = "You must enter a valid e-mail address.";
e.Cancel = true;
}
else
{
Login1.InstructionText = String.Empty;
}
}
</script>
<asp:Login ID="Login1" runat="server"
DisplayRememberMe="False"
TitleText="Log on here"
DestinationPageUrl="somewhere"
orientation="Horizontal"
textlayout="TextOnTop"
UserNameLabelText="USERNAME:"
PasswordLabelText="PASSWORD:"
OnLoggingIn="OnLoggingIn"
OnLoggedIn="OnLoggedIn">
<TitleTextStyle Font-Bold="True" ForeColor="#000000" BackColor="#FFFFFF"></TitleTextStyle>
</asp:Login>
Hi Antonio,
I'm not sure you need to record the last login date and time in your method SiteSpecificUserLoggingMethod, as this is normally accessible throughout the site via Membership.GetUser() which will return the current logged in user, which has properties for determining last login, etc. So my guess is you can just redirect to your acceptance page from here.
Then for the acceptance of conditions, I would save a flag (cookie, session, property if it needs to be accecpted only once and not at each login) indicating if the conditions have been accepted or not.
In your logged in area page template(s), I would then make a check in the OnLoad event to make sure the person accessing the page has logged in and has accepted the terms and conditions. So Something like this, if we suppose you save the acceptance flag in the session:
Hope this helps setting you on track.
Cheers,
Michael.
Hi Michael
Thank you much for your answer, my Asp.Net understanding is null, so the project has been ussigned to another person.
Thanks again for your suggestions.
Cheers
Antonio
is working on a reply...