I am facing a strange issue. It looks like silly but it took lot of time to figure it out.But still i do not find solution.
I am fetching few of few data sources(connecting to 3rd party web service) on page load of web part(share point 2013 version).
In order to connect 3rd party web service, we are passing one of header value(Key) which is provided by the web service provider from IClientMessageInspector.BeforeSendRequest using custom endpoint behavior. Then we are adding the custom endpoint to service client endpoint before making any service client method call.
The code is working fine when i put up a break point and try to debug and run the page but when i try to run from the site pages directly i am getting error as "The remote server returned an error: (403) Forbidden." In order to avoid 403 error we are sending the header value which works well for us.
Even from a sample asp.net site page or console app (with the header value) we are able to get data from web service.
I could not find any solution from search.Please help me out. Thanks.