I'm a stranger in .Net land, you'd have to explain to me in crayon.
At the url link indicated, I see an example for C# as below:
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<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);
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>ASP.NET Example</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Login id="Login1" runat="server" OnLoggedIn="OnLoggedIn"></asp:Login>
</form>
</body>
</html>
<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);
}
</script>
So it will redirect to specified location rather than recording date and time.
you'll have to share some info on what exactly you mean with 'redirect to the Members home'? Do you want members to redirect to a specific page? is that page the same page for every member? Or do you have different "home" pages for the members logging on?
If you have the same page for all members logging in, then you'd need to do the LoggedIn event as you could protect that "home" page (and underlying pages) using the umbraco ui. (Right click on "home" page node, and select 'Public access' which will popup a dialog), and umbraco will handle the authentication process
On the dialog, choose 'Role based' protection and then choose what member group(s) are allowed to enter this page. Also mark what page you'll be using as the login page (the page you're putting the login control on) and set an error page (which will be used for unauthorized access...)
If your login control is appearing on every page and would like members to log in from any page, then use the LoggedIn event for redirection using Response.Redirect(umbraco.library.NiceUrl(id));
Yes, we want all members to be redirect to a specific page.
I created the section and set the Public Access parameters so the members section is protected. I selected a public page, clientlogin.aspx (page with the login control), as the login page and set the same page as error page (hoping to add an error message with a url attribute or similar), I don't see anywhere to set what page the user should be sent to on successful login. Login works and a welcome message is returned on that same page and I could add a link to the members home as below:
use the LoggedIn event for redirection using Response.Redirect(umbraco.library.NiceUrl(id));
Also, there is a link to "Client Login" in the header of my template. If I figure out the "LoggedIn event", could I use it to display a "Log Out" link there instead for logged in users?
you don't need to set the page the member will be redirected to, it's been handled by the login control. If a member browses to the protected section (page and underlying pages), he will be redirected to the login page you've specified, and be redirected to the page he requested upon succesful login.
However, if you put the asp.net login control on the master template for example (so it becomes available from any page), and the user enters his credentials, he won't be redirected but stay on the same page (well, in fact, he's being redirected to the same page). In that case, you'd need the LoggedIn event to redirect the user to the member's home page (csa-home.aspx)
Ok, let's recap: Are you using a asp.net login control on a master template (available on all pages), or just using the login control on the login page you've specified in the 'Public access' dialog?
I am using a asp.net login control on just the login page specified in the 'Public access' dialog. Thanks to your help, I do understand now that if I just point the links to "Client Login" at the
protected "Members Home" instead of the actual page that has the login
control, I don't need to redirect. Problem solved, thank you very much.
The remaining complication is the "Client Login" link in the master template.
In the master template is a simple link for the clients to access login from anywhere on the site:
Show if Logged In: <a href="javascript:__doPostBack('ctl00$ctl00$ctl00$ctl00$ContentPlaceHolderDefault$childContent$childContent$UmbracoLoginView$LoginStatus1$ctl00','')" style="text-align:right; color:white; font-size:.67em;">Logout</a>
Show if Not Logged In: <a href="/csa-home.aspx" style="text-align:right; color:white; font-size:.67em;">Client Login</a>
The "logout link" javascript url was copied from the "logout link" displayed on the actual login page after successful login. It does work to display the "Login" link to users who are not logged in and "Logout" to users who are but the logout link does not actually work unless you are on the actual login page.
Adding redirect to Members home at login
Hi! We're using the following to generate a login form:
Is there an easy way to redirect to the Members home upon successful login?
Thanks in advance.
Sure that's possible Teena, you should register for the LoggedIn event that fires on succesful login and redirect member to its home page.
Cheers,
/Dirk
I'm a stranger in .Net land, you'd have to explain to me in crayon.
At the url link indicated, I see an example for C# as below:
I can see how this would idicate changing
To:
But don't know what to do with:
So it will redirect to specified location rather than recording date and time.
Thanks for trying.
you'll have to share some info on what exactly you mean with 'redirect to the Members home'? Do you want members to redirect to a specific page? is that page the same page for every member? Or do you have different "home" pages for the members logging on?
If you have the same page for all members logging in, then you'd need to do the LoggedIn event as you could protect that "home" page (and underlying pages) using the umbraco ui. (Right click on "home" page node, and select 'Public access' which will popup a dialog), and umbraco will handle the authentication process
On the dialog, choose 'Role based' protection and then choose what member group(s) are allowed to enter this page. Also mark what page you'll be using as the login page (the page you're putting the login control on) and set an error page (which will be used for unauthorized access...)
If your login control is appearing on every page and would like members to log in from any page, then use the LoggedIn event for redirection using Response.Redirect(umbraco.library.NiceUrl(id));
Let us know if you need more info.
Hope this helps.
Regards,
/Dirk
Yes, we want all members to be redirect to a specific page.
I created the section and set the Public Access parameters so the members section is protected. I selected a public page, clientlogin.aspx (page with the login control), as the login page and set the same page as error page (hoping to add an error message with a url attribute or similar), I don't see anywhere to set what page the user should be sent to on successful login. Login works and a welcome message is returned on that same page and I could add a link to the members home as below:
But it seems like an auto redirect on successful login is the logical activity, a more elegant solution.
Thanks, as always for your help. It's the last day of my Umbraco project and you guys have been great.
This is the part I don't follow:
use the LoggedIn event for redirection using Response.Redirect(umbraco.library.NiceUrl(id));
Also, there is a link to "Client Login" in the header of my template. If I figure out the "LoggedIn event", could I use it to display a "Log Out" link there instead for logged in users?
Athanks in advance.
you don't need to set the page the member will be redirected to, it's been handled by the login control. If a member browses to the protected section (page and underlying pages), he will be redirected to the login page you've specified, and be redirected to the page he requested upon succesful login.
However, if you put the asp.net login control on the master template for example (so it becomes available from any page), and the user enters his credentials, he won't be redirected but stay on the same page (well, in fact, he's being redirected to the same page). In that case, you'd need the LoggedIn event to redirect the user to the member's home page (csa-home.aspx)
Hope this helps.
Ok, let's recap: Are you using a asp.net login control on a master template (available on all pages), or just using the login control on the login page you've specified in the 'Public access' dialog?
/Dirk
I am using a asp.net login control on just the login page specified in the 'Public access' dialog. Thanks to your help, I do understand now that if I just point the links to "Client Login" at the protected "Members Home" instead of the actual page that has the login control, I don't need to redirect. Problem solved, thank you very much.
The remaining complication is the "Client Login" link in the master template.
In the master template is a simple link for the clients to access login from anywhere on the site:
I would like to alter this to:
Looking at the syntax in the login form, I tried:
The "logout link" javascript url was copied from the "logout link" displayed on the actual login page after successful login. It does work to display the "Login" link to users who are not logged in and "Logout" to users who are but the logout link does not actually work unless you are on the actual login page.
Thanks in advance.
You should use the LoginStatus control instead of the LoginView for that.
Cheers,
/Dirk
What does that look like? I tried this:
xxx
It returned the form error:
So I tried this:
Which returned this error:
If I have the syntax basically right, I will try move the existing form tags to wrap the whole template.
Yup, that should be the solution, can only have one server side form tag in your asp.net templates.
Cheers,
/Dirk
is working on a reply...