I am seeing some strange issue in force.com site page.

  1. I have created 2 visualforce pages.
  2. After saving some information on first page I am redirecting the user to second page using action method.
  3. On second page, I have used a action method which will check whether the user should see second page or not. < apex:page action="{!IsValidUser} >

public PageReference IsValidUser(){

//Logic to redirect the user


  1. When I access the second page like salesforce.com/apex/secondPage then action method {!IsValidUser} gets invoked every time when I refresh the page from the org.

  2. However, when I use the same page in force.com site like
    developer-edition.na7.force.com/secondpage then action method {!IsValidUser} DOES NOT get invoked every time when I refresh the page from url.

  3. It gets invoked when I redirect the page from firstPage to secongPage using action method.

Does anyone has any idea about this issue?

@ Mark Pond,

Thank you for your response. Please find below my action method:

public PageReference IsValidUser(){
String uid = ApexPages.currentPage().getParameters().get('uid');

User_Registration__c userRegToUpdate;
                  User_Registration__c uReg = [Select id,IsRedirectedFromFirstPage__c from User_Registration__c where UID__c =:uid];
                  if(uReg.IsRedirectedFromFirstPage__c == true){
                  userRegToUpdate = new User_Registration__c(id=uReg.id);
                  userRegToUpdate.IsRedirectedFromFirstPage__c = false;
                  update userRegToUpdate;
                      //Redirect user to login page if IsRedirectedFromFirstPage__c is false
                      PageReference pageRef = new PageReference('/indexApex');
                      return pageRef;

    }catch(Exception e){

return null;

Visualforce page which I am using for second page is like below:

<apex:page docType="html-5.0" showHeader="false" sidebar="false" standardController="Account" extensions="loginPageController" action="{!IsValidUser}" >   </apex:page>

Mark, while doing some research on this issue, I found that I am facing this issue in Mozilla browser, when I just paste my site url in address bar and hit enter it does not execute action method, however, when I hit f5 to refresh the page, action method does execute. Is it related to below issue?

Losing all data on VF page after pressing F5 button

Thanks, Jagmohan

  • 1
    Can you add the controller code and the VF markup of these two pages to demonstrate the problem? – Mark Pond Jul 19 '13 at 20:12
  • @LaceySnr I have updated my question, please let me know if you need more information. – user3077 Jul 22 '13 at 6:00
  • Did you get any solution to your problem ? I am also facing a similar issue. – S.Sharma May 13 '14 at 5:04
  • Is cache=false on page and composition template? – bigassforce Jul 18 '18 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.