Ignorance of the code/law regarding ethical behaviour

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