Iranian President Mahmoud Ahmadinejad on a visit to Uganda said proposed U.N. sanctions against his country are illegal.