More in this section

Forums / Developing with Sitefinity / Custom page delivered after login

Custom page delivered after login

9 posts, 0 answered
  1. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    05 Nov 2008
    Link to this post
    Is there a simple way to redirect someone to their own custom page after log in depending on who they are?

    This would be on the public site. Say if I want to have a client portal and after a user logs in, they are directed to their specific client page with information pertinent to them.



    Thanks.
  2. Gabe Sumner
    Gabe Sumner avatar
    440 posts
    Registered:
    09 Sep 2007
    05 Nov 2008
    Link to this post

    Hi Laura,

    I haven't tested this, but I would imagine you could do this in ASP.NET's "global.asax" file.  I believe you could do this in the "Application_AuthenticateRequest" event.

    The link below does not specifically address this topic, but it does show how to use the "Application_AuthenticateRequest" event.

    https://secure.codeproject.com/KB/web-security/formsroleauth.aspx?display=PrintAll&fid=6668&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=76&select=1975715

    Gabe Sumner
    http://www.goondocks.com/

  3. SelAromDotNet
    SelAromDotNet avatar
    912 posts
    Registered:
    18 Jul 2012
    06 Nov 2008
    Link to this post
    i'm still new to stuff like this but doesn't the Application_AuthenticateRequest fire on every page request as part of the lifecycle? if you put the logic there, no matter what page they tried to access, they would be directed to that page...

    I think a better approach might be to use the defaultUrl of the authentication setting in web.config, and have it go to something like "redirect.aspx" and on that page, have the logic to redirect the user to their appropriate page.

    just an idea, hope this is helpful!
  4. Vlad
    Vlad avatar
    498 posts
    Registered:
    19 Jun 2017
    06 Nov 2008
    Link to this post
    Hi,

    Thanks Gabe and Josh,

    Yes, if you put a logic in the Application_AuthenticateRequest event handler, it would be executed on each request. But from the other side, you cannot place such logic in the web.config.

    Therefore, I think, the best approach is to add the code directly in your Login user control. You can add a handler for the LoggedIn event of the standard ASP.NET Login control, e.g.:

    using System;  
    using System.Web.UI;  
    using System.Web.UI.WebControls;  
     
    public partial class UserControls_FinalLoginControls_LoginControl : UserControl  
    {  
        void Page_Load(object sender, EventArgs e)  
        {  
            this.Login1.LoggedIn += new EventHandler(Login1_LoggedIn);  
        }  
     
        void Login1_LoggedIn(object sender, EventArgs e)  
        {  
            string userUrl = String.Format("~/account.aspx?user={0}"this.Login1.UserName);  
            this.Response.Redirect(this.ResolveUrl(userUrl), true);  
        }  

    Hope this is helpful.

    Kind regards,
    Vlad
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  5. Laura
    Laura avatar
    311 posts
    Registered:
    25 Feb 2008
    06 Nov 2008
    Link to this post
    Thank you Gabe, Josh and Vlad.

    I implemented Vlad's suggestion as it seemed like the simplest...and it worked just fine.

    We will be looking to extend this though for building online communities and customizing and securing each persons section. It seems this is just where the SNP project stopped.  It would be great to see that explained further.

    Thanks for your help!
  6. Robert hinojosa
    Robert hinojosa avatar
    8 posts
    Registered:
    20 Aug 2005
    03 Dec 2008
    Link to this post
    I second the request for the SNP project to be followed up.  For example, filtering items based on group, example scheduler or documents and images.
  7. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    08 Dec 2008
    Link to this post
    Hello Robert hinojosa,

    there has been quite a few requests for the SNP project to be continued. Obviously, at the time I started to work on the project I estimated there will be time, however, I was proven wrong very soon.

    I will try to find a way to restart the project, perhaps as an open source or something of that kind - though I cannot promise anything at this moment.

    Just wanted to let you know that your requests have been heard.

    Kind regards,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  8. Robert hinojosa
    Robert hinojosa avatar
    8 posts
    Registered:
    20 Aug 2005
    08 Dec 2008
    Link to this post
    I completely understand Ivan.  

    If time is very precious, I think even spending a little more time in doing an in-depth outline of the things that need to happen to support this type of functionality.  If we can get these stories in place, then we can certainly help with the implementation.  We are mostly all developers here and we can certainly help out, so open source is a great idea.  

    I think a true implementation like SNP pushes the envelope on many portal and social networking type sites, which are essentially just using a website as a communication tool.  And ultimately, that's what many business need, not just a website, but an application that can serve as a communications tool. 
  9. Ivan
    Ivan avatar
    478 posts
    Registered:
    16 Jun 2015
    08 Dec 2008
    Link to this post
    Hello Robert hinojosa,

    I'll try to find some inside-volunteers and we'll see what can we do about open source idea. I like the open source approach because it would also be a great showcase of what is Sitefinity capable of and how should the bigger upgrades be done - following best practices - of course.

    So, I'll try to get some traction here and we'll see what happens. I'll be sure to blog about any progress.

    Regards,
    Ivan
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Register for webinar
9 posts, 0 answered