1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Redirect to login page w/o 403 error?

Redirect to login page w/o 403 error?

3 posts, 0 answered
  1. Ethan
    Ethan avatar
    3 posts
    Registered:
    22 Jun 2012
    22 Jun 2012
    Link to this post
    I have a pretty standard Sitefinity 5.0 SP1 setup. The main content is only available to authenticated users. I would like users to be redirected to the login page if they try to access a restricted page. I can do this with CustomErrors to redirect 403 errors to ~/login, but I'd like to be able to tell Sitefinity to simply serve the login page to insufficiently credentialed users <strong>without</strong> throwing the 403 error in the first place. Partially because I'd like to avoid appending the aspxerrorpath query string to the login page during normal use, and partially because I'd like users to be redirected to the the login page from the server while still having CustomErrors set to RemoteOnly.

    I've seen some solutions that involve dragging a custom control onto each protected page, but I really don't want to do that because it defeats the purpose of having Sitefinity's built-in permissions structure and it's easy to mess up.
  2. Brett Whittington
    Brett Whittington avatar
    89 posts
    Registered:
    10 Aug 2012
    22 Jun 2012
    Link to this post
    Have you looked at setting the page permissions in the backend?  If you click on actions > Permissions, you could change the view permission of the page to only the user you designate.  By default most pages are enabled for everyone.  These is a hierachy structure so you wouldn't need to add a control to every page but all subpages would use the parent pages permissions.  This wouldn't do it automatically, you might have to go into every page's permissions to set this but it does beat adding a custom control.

    The only other way I see doing this adding a handler to site which looks at the request and queries for the page based on the url.  Once you have that, you could then check the for permissions.  This seems like overkill though since you will have to query for the pages twice on every request.
  3. Ethan
    Ethan avatar
    3 posts
    Registered:
    22 Jun 2012
    22 Jun 2012
    Link to this post
    Yes, currently I have the page permissions set, which is what causes Sitefinity to return the 403 error code.

    Handlers might work, I'll look into that as a possible solution.


3 posts, 0 answered