Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

Customising the CMS /

Dynamic ErrorPages


Reply


4 Posts   732 Views

Avatar
neros3

Community Member, 51 Posts

20 October 2010 at 10:50am

Hi

Im currently trying to work out how to have dynamic ErrorPages in SS.

- What I would like is to be able, upon access restrictions, to send 403 to the browser and show a page with a dynamic message.

- Problem right now is first of all, that when I create an ErrorPage in CMS and set errorcode to 403 the created page in assets-folder is zero kb == empty !!
With a static errorpage I couldn't set custom errormessages like: "you are not allowed in this specific section".

How are you dealing with 403 errors?

Thanks!

Avatar
neros3

Community Member, 51 Posts

27 October 2010 at 7:09am

Perhaps Im all wrong with this approach... So let me try to clarify my needs a bit, perhaps someone knows about a work around.

1. First an anonymous user tries to access a secure page.
2. The user gets redirected to the loginpage and logs in.
3. User still has no access to the page and 403 is sent to the browser - with a little message (ALREADYLOGGEDIN).

- What I would like to do is to be able to show a real page, instead of just the error message, to the user.
I have tried creating an Error Page with error code 403, but the created page in assets is empty - and still if I put text in that page it never gets displayed.

Hope this helps...

Avatar
neros3

Community Member, 51 Posts

28 October 2010 at 8:26am

Status so far...

The only way I've been able to actually display the 403 page (static page from assets-folder) is via allowed actions like this:

public static $allowed_actions = array(
"index" => "->returnsFalse"
)

Any help is appreciated!

Thanks!

Avatar
JonoM

Community Member, 103 Posts

29 March 2013 at 10:38am

For anyone stumbling on this post, this might help: http://www.silverstripe.org/general-questions/show/15289