function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
BenPBenP 

Random authorization required

I have a public site setup, but I've started getting random reports of users seeing the authorization required page.  I have all inserts/updates wrapped in try catch statements, but I haven't been able to replicate the problem to see the error in a debug log.

Is there a better way to catch random errors like this?  Maybe if the user hits the authorization required page, email everything to me or something?

I'm a beginner with APEX so forgive my ignorance.
Sure@DreamSure@Dream
Check whether all the vf pages required and object permissions required are added to corresponding profile or not.
BenPBenP
This site has been working fine for quite some time.  I did chech all vf pages are added as well as all object permissions are correct.

The user can try now and receive an error, but try again later and have it work perfectly.
Offshore Freelance ConsultantOffshore Freelance Consultant
Hi,

We get authorization required message, even if the visual force page/controller faced some errors.

Option 1 -        If you can reproduce the random occurence of the error.
              Put Try{ } Catch{} statements in ur code in all the functions and in the catch, write System.Debug(e.getMessage();
              Enable Debugging for Site User(get this user from public access settings of the site->profile->user id.

               reproduce the error, this will log the error in debug logs. 
               fix the code.

Option 2: - You cannot reproduce the error but happens only at customer/user end.
                 Instead of system.debug in you catch, write code to send an email to u with the error message.
                 When u get the email with error message, fix it and deploy.

********************************
Hope this helps!

JG