Ignorance of the code/law regarding ethical behavior

Why is ignorance of the code/law regarding ethical behavior not a defense for charges of unethical conduct?