Redirect to login page w/o 403 error?

Posted by Community Admin on 04-Aug-2018 15:11

Redirect to login page w/o 403 error?

All Replies

Posted by Community Admin on 22-Jun-2012 00:00

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.

Posted by Community Admin on 22-Jun-2012 00:00

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.

Posted by Community Admin on 22-Jun-2012 00:00

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.


This thread is closed