Try our conversational search powered by Generative AI!

Geta Not found handler not redirects pages that are not visible to everyone

ZZ
ZZ
Vote:
 

Hi,

We are using Geta NotFound handler to make use of custom redirects. Redirects works fine for the pages that are visible to everyone., but not for the pages where virtual role "Authenticated" is set for restricting visibility.  

Any input would be appreciated.

#308328
Sep 11, 2023 10:27
Vote:
 

Can you elaborate ? With "Authenticated" pages what do you want to do and what is the current behavior? 

#308330
Sep 11, 2023 10:33
ZZ
Vote:
 

Pages that are visible to "Restricted". Pages that don't contain "EveryOne" ->

We are not getting any error. The redirect is just not working. It still try to access the URL (old) and not the redirect one 

#308335
Sep 11, 2023 11:01
Vote:
 

A shot in the dark but it could be that NotFoundHandlerMiddleware is registered after whatever middleware that handles the access right redirect. You might want to add UseNotFoundHandler as early as possible 

#308337
Sep 11, 2023 13:01
Vote:
 

try to call it before UseAuthentication :) 

#308345
Sep 11, 2023 15:49
ZZ
Vote:
 

Its already called before Authentication. ->

if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                // Use custom exceptions pages when in Release mode.
                xxxxxxx
            }

            if (!string.IsNullOrEmpty(xxx))
            {
                app.UseMiddleware<xxx>(_configuration.xxx);
            }
            app.UseNotFoundHandler();
            app.UseOptimizelyNotFoundHandler();

            // Add the image processing middleware.
            app.UseBaaijteOptimizelyImageSharp();

            app.UseHsts();
            app.UseMiddleware<xx>();
            app.UseWebOptimizer();
            app.UseContentTypeIcons();
            app.UseAllElasticApm(_configuration);
            app.UseStaticFiles();
            app.xxx();
            app.UseRouting();

            app.Map(new PathString("xxx"), map =>
            {
                xxx
            });

            app.UseAuthentication();
            app.UseAuthorization();
            app.UseEndpoints(endpoints =>
            {
                endpoints.MapDefaultControllerRoute();
                endpoints.MapRazorPages();
                endpoints.MapContent();
            });
}
#308388
Sep 12, 2023 7:30
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.