problems calling an external web service

gallicus

Member
Joined
Dec 31, 1969
Messages
15
Location
at work... probably :-(
Hello,

I am writing an app which consumes a external web service. My app sits behind a proxy server. When I first tried to call the external webservice I recieved the error

"The request failed with HTTP status 407: Proxy authentication required."

I looked into why this was happening and found out that the ASPNET user would not have authority to go through the proxy for security reasons. So I found some code to override the proxy shown below


//create a new proxy object
WebProxy myProxy = new System.Net.WebProxy("http://proxy:80", true);

//give proxy users credentials as they can access internet
myProxy.Credentials = new NetworkCredential("username", "password", "domainname");

//create an instance of the service to be consumed
//(downloaded using WSDL.exe)
DiscountFileReceiverService service = new DiscountFileReceiverService();

//asigned the proxy object to this service
service.Proxy = myProxy;


I then called the service and got it to work once. A few days laters when trying to run the code I get the 407 error message again. Are there any other factors involved which might be causing the error? Is this the best way to call a web service through a proxy?

TIA
 
Back
Top