Where is the clientaccesspolicy.xml file located? It should be at the root of the server that hosts your web adaptor or proxy, like http://sampleserver6.arcgisonline.com/clientaccesspolicy.xml. If open your application while a debugger or intercepting proxy like Fiddler is running, so you see that the clientccesspolicy file on the GIS Server is being accessed?
Thanks for the help.
I misplaced clientaccesspolicy.xml on my server. I now placed it at the root of my server and the part of the code was also missing. I now corrected it to resolve the issue with clientaccesspolicy file.