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

Check if a user has access to a visualforce page

Is there a way to check if the current running user has permission to access a specific visualforce page?


you can't achive this at  user can check with the profile... 


how would check if the profile has access in code?


Hi Scott,


        Go to that visualforce page under setup-->click on security settings of that vf page -->enable the profile access for which you want to give access to vf page


Yes, but I want to check if the running profile has access to an unknown page before I send the user there.


class sudo{


  public pageReference myAction() {


      //do something


      if(user has access to page)

         return user_configured_page


         return other_page






u can check the profile check in the page level itself....


like {!$} == 'system admin'... then only you can process.....

Imran MohammedImran Mohammed

No, that can be found through Apex.

The only way is through what kiran has mentioned.


Did anyone get the solution? please reply


Hi did you get the solution to this problem i am also having same issue.

khillan bhardwajkhillan bhardwaj

Yes we can check whether login user have access to the specific page.following is the code which show. whether login user have access to given page.

List < SetupEntityAccess> SEA =[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 = 'Given Page  name' AND NamespacePrefix = null)];
      //Login user do not have access to given page
     //login user have access to given page

Hope it will be helpful to you.

Khillan Singh