Check User Access Permission To Visualforce Page In Apex

Sample Code:

List<SetupEntityAccess> seaList = [SELECT Id, Parent.Name, Parent.Profile.Name, Parent.Profile.Id FROM SetupEntityAccess
                                   WHERE Parent.Profile.Id = :UserInfo.getProfileId() AND SetupEntityId IN
                                   (SELECT Id FROM ApexPage WHERE Name = :your_VF_page AND NamespacePrefix = :your_namespace)];

    //Login user have access to given VF page
    //login user don't have access to given VF page

Query Rows & Collection size exceeds maximum limit

Visualforce Page:

<apex:page controller="yourCustomcontroller" readonly="true">  

Please note using readonly="true" in Visualforce page, can increase Query Rows & Collection size:

  • Query Rows limits increased from 50001 to 1 million rows.
  • Collection size limits increased from 1001 to 10000.