It is therefore clear that all courts and persons having by law or consent of parties authority to receive evidence are authorised to administer oaths and affirmations, but they can do so only where they are otherwise acting" in the discharge of the duties or in exercise of the powers imposed or conferred upon them respectively by law." So the court or person mentioned in clause (a) of section 4 of the Oaths Act can administer oath or affirmation to the deponent in an affidavit only if the, court or person in acting in the "discharge of the duties or in exercise of the powers im posed or conferred upon them respectively by law." In the present cases, the Magistrates concerned with the proceeding under section 145 of the Code were discharging the duties imposed and exercising the powers conferred by the Code, and they alone could administer the oaths and affirmations to the persons who made the affidavits, and not the magistrates who were not discharging any such duty or exercising any such power.