cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
nanoka
Frequent Visitor

Display "Page Not Found" when an anonymous user accesses a page to which they do not have permission

Hello.

 

I would like to configure the following about Power Apps Portals, and I was wondering if you know anything about it.

 

I have set the permissions for a particular page to only allow "Administrators" and "Authenticated Users".
This page will only be accessible by "Administrators" and "Authenticated Users", but not by "Anonymous Users".

 

If you try to access this page as an "anonymous user", you will get an error like the following
I would like to change this so that "Page Not Found" or "Access Denied" is displayed instead of an error.

 

Is such a setting possible?

 

[Displayed custom error page]

image.png

1 ACCEPTED SOLUTION

Accepted Solutions
nanoka
Frequent Visitor

This was a problem I had been struggling with for a long time, but it was solved.

The problem was solved by changing the Page Template of the Access Denied page, as shown in the following page.

Thanks!


Solved: Portal error when enabling Web page Access Control... - Power Platform Community (microsoft....

View solution in original post

3 REPLIES 3

Hi @nanoka ,

If the user doesn't have access to the page it should automatically be shown an access denied message, not an error. In your case, something definitely went wrong. You need to find out what exactly error you get. For that, you can disable custom error messages or configure logging.

----------------------------------------------------
If you find this post helpful consider marking it as a solution to help others find it.

@OOlashyn 

Thank you so much for your help.

I have disabled custom errors and checked the errors shown.
Is there anything you can think of about the errors that are showing up?

 

nanoka_0-1636522161104.png

 

Server Error in '/' Application. The route handler 'Adxstudio.Xrm.Web.Routing.PortalRouteHandler' did not return an IHttpHandler from its GetHttpHandler() method. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.InvalidOperationException: The route handler 'Adxstudio.Xrm.Web.Routing.PortalRouteHandler' did not return an IHttpHandler from its GetHttpHandler() method. Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [InvalidOperationException: The route handler 'Adxstudio.Xrm.Web.Routing.PortalRouteHandler' did not return an IHttpHandler from its GetHttpHandler() method.] System.Web.Routing.UrlRoutingModule.PostResolveRequestCache(HttpContextBase context) +623 System.Web.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +223 System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +220 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +94

 

 

Also, I have a feeling that "Access Denied" is simply not working properly. Is there a setting to enable "Access Denied", especially if I have not changed the default configuration?


If so, please let me know.

nanoka
Frequent Visitor

This was a problem I had been struggling with for a long time, but it was solved.

The problem was solved by changing the Page Template of the Access Denied page, as shown in the following page.

Thanks!


Solved: Portal error when enabling Web page Access Control... - Power Platform Community (microsoft....

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

MPP IDEAS updated 768x460.png

Ideas

Discover ideas and concepts from users like you for how to use Power Pages and take your work to the next level.

Carousel News & Announcements

What's New in the Community?

Check out the latest News & Events in the community!

Top Solution Authors
Users online (3,062)