If you are sure that you have writtent the code right or used the code shared by CCavnue then look for the following to solve this issue.
* Check the Web.config for missing WorkingKey Should be placeed <add key=”WorkingKey” value=”WORKING KEY VALUE HERE”/>
* Request URL should be same for which the API Keys are issued.
* Access Code, WorkingKey and Merchant ID used correctly and should belong to requesting URL.
* The DLL are placed in BIN folder correctly and application has the access to it.
* Application pool might be enabled to process 32 bit applications.
Comment for more help