This is for a public site I'm building.
So I'm sending a parameter to check and see if a URL parameter is valid. However, every time the send a parameter that is not found the page redirects me to an Authorization Required Page.
Below is my code to grab the parameter then the getContactFound method which the page only loads when the contact is correct.
What is the return valud for getContactID when the parameter is not found
public String getContactID(){
return System.currentPageReference().getParameters().get('contactID');
}
Why is the function not working when the parameter is not found
public boolean getContactFound(){
if (getContactID() == null || getContactID().length() == 0){
return false;
}
Id caster = Id.valueOf(getContactID());
Contact C = [SELECT Id FROM Contact where id =: caster];
if (C == null){
return false;
}else{
return true;
}
}
Any ideas as to what is wrong?