SF 5.2, private/public pages setup
Hi.
Hopefully someone can point me in the right direction. If you have even part of an answer, please reply with that part - at least I will have something to start off with.
We have SiteFinity 5.2 installed, and we need to have a public and a secured section.
Here are our requirements :
- Login / Logoff controls, with proper "Welcome xyz" type message - I believe there are widgets for this;
- Login form only visible when the user is not logged in;
- Request for a password reset found this for proper setup http://www.sitefinity.com/devnet/kb/configuring-password-recovery-in-sitefinity);
- If a person tries to access a secured page directly, show a custom login page, not the Sitefinity default one;
- Display a Menu based on the site map that would display/hide entries based on when you are logged on/off.
This may sound like obvious to some of you, but I can't seem to find the exact right way to achieve this, specialy with the line in bold above.
Thanks for your help!
Hi,
Thank you for using our services.
1. You can use the login name widget and customize the message string to display "Welcome, FirstName LastName" instead of only the name of the user:http://screencast.com/t/drLiVW8AuLIV
In addition, you can use the Login/Logout button which will change depending on the status of the user:http://screencast.com/t/Cl9XY1q0. For the Login/Logout button you need to configure the login and logout urls. You can find more information here:Configuring the Login status widget
2. This is not available out of the box. You can create a dedicated login page(not available in the navigation) with the Login control in it. When a user clicks on the Login button or tries to access a page that requires authentication, he will be redirected to the login page.
3. You can also take a look at this article:Configuring the password recovery
4. The Sitefinity login will be shown only if that user has backend access, frontend users will never be taken to the /Sitefinity login page. One of the ways to secure a frontend page is to restrict the access to only a specific Role. That way when an anonymous users tries to access it, you will be able to intercept the event in the Global.asax and redirect to your custom login page. Here is a small sample how this is done in the Global.asax:
using
System;
using
System.Linq;
using
Telerik.Sitefinity.Abstractions;
using
Telerik.Sitefinity.Services;
using
Telerik.Sitefinity.Web.Events;
namespace
SitefinityWebApp
public
class
Global : System.Web.HttpApplication
protected
void
Application_Start(
object
sender, EventArgs e)
Bootstrapper.Initialized +=
new
EventHandler<Telerik.Sitefinity.Data.ExecutedEventArgs>(Bootstrapper_Initialized);
void
Bootstrapper_Initialized(
object
sender, Telerik.Sitefinity.Data.ExecutedEventArgs e)
EventHub.Subscribe<IUnauthorizedPageAccessEvent>(
new
Telerik.Sitefinity.Services.Events.SitefinityEventHandler<IUnauthorizedPageAccessEvent>(OnUnauthorizedAccess));
void
OnUnauthorizedAccess(IUnauthorizedPageAccessEvent unauthorizedEvent)
var url = unauthorizedEvent.Page.Url.TrimStart(
'~'
);
if
(unauthorizedEvent.Page.Title.Contains(
"pp"
))
unauthorizedEvent.HttpContext.Response.Redirect(
"~/p1"
);
else
unauthorizedEvent.HttpContext.Response.Redirect(
"~/"
);
protected
void
Session_Start(
object
sender, EventArgs e)
protected
void
Application_BeginRequest(
object
sender, EventArgs e)
protected
void
Application_AuthenticateRequest(
object
sender, EventArgs e)
protected
void
Application_Error(
object
sender, EventArgs e)
protected
void
Session_End(
object
sender, EventArgs e)
protected
void
Application_End(
object
sender, EventArgs e)
Thanks for the information.
I believe the Telerik.Sitefinity.Web.Events namespace is only available starting SF 5.2 because I had issues with a 5.1 not finding it. I will give this a try - thansk!
BTW, can you tell me where you get these sample code from? Is this somewhere available on the NET?
Thanks.
Hi,
We create them when helping clients and maintain an internal code sample repository. That way we can easily access them if we encounter a similar case in the future.
Kind regards,