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

Forums / General Discussions / Custom access error message

Custom access error message

6 posts, 0 answered
  1. li
    li avatar
    30 posts
    Registered:
    02 Jan 2009
    13 Aug 2010
    Link to this post
    When I try logging in with a username who has no rights to some pages, I get .net error message:

    This type of page is not served.


    How can I do to make my own custom error page for this?
  2. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    15 Aug 2010
    Link to this post
    Hi li,

    Take a look at customErrors Element (ASP.NET Settings Schema)

    Kind regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. li
    li avatar
    30 posts
    Registered:
    02 Jan 2009
    16 Aug 2010
    Link to this post
    Hi,
    Thank you for your reply, but this is not what I need. I set up a page permissions for one page so role "customer" can't access this page. and then if I login as a customer and access this page, I'll get a error page. -- Is there a way to make a custom error message like "you don't have right to access this page..." in such scenario?
  4. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    17 Aug 2010
    Link to this post
    Hello li,

    If you are logged in to the backen and click on a page for which you do not have rights you do not get a error page. There is only a label shown through js that says "You have no permissions to view this page."

    When you make a not authorized request to a page, the status code that is returned is 404 so you can use the cutomErrors element and set it with a custom errors page.
    
    
    Regards,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  5. li
    li avatar
    30 posts
    Registered:
    02 Jan 2009
    17 Aug 2010
    Link to this post
    Hi Ivan,
    When making a "not authorized request to a page", can I add some custom logic so that I can separate this from other 404 cases?
    Thanks,
  6. Ivan Dimitrov
    Ivan Dimitrov avatar
    16072 posts
    Registered:
    25 Nov 2016
    17 Aug 2010
    Link to this post
    Hi li,

    You can write some code in Global.asax file - Application_Error event.

    sample

    Exception ex = Server.GetLastError();
    if (ex is HttpException)
    {
        HttpException httpEx = ex as HttpException;
         
    }


    Sincerely yours,
    Ivan Dimitrov
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Register for webinar
6 posts, 0 answered