To specify the proxy server, set the Machine.config or Web.config file
settings as follows:

<configuration>
   <system.net>
      <defaultProxy>
         <proxy
            usesystemdefault = "false"
            proxyaddress="http://proxyserver";
            bypassonlocal="true"
         />
      </defaultProxy>
   </system.net>
</configuration>

http://support.microsoft.com/kb/318140
Also try this,

Dim myService As New MyWebService
Dim proxyObject As New System.Net.WebProxy("http://proxyserver:80/";, True)
myService.Proxy = proxyObject

myService.MyMethod()
http://www.devx.com/vb2themax/Tip/18876


Please refer to the below links as well
http://stackoverflow.com/questions/859224/calling-a-webservice-from-behind-a-proxy-server
http://www.codeproject.com/KB/webservices/web_service_by_proxy.aspx
http://ilvyanyatka.spaces.live.com/Blog/cns!1pd2dVb-lPLLY1vqAckmYW8A!124.entry?wa=wsignin1.0&sa=331292904
http://www.c-sharpcorner.com/UploadFile/thiagu304/webservicebehindproxy11212006054829AM/webservicebehindproxy.aspx


On Tue, Nov 10, 2009 at 10:26 PM, Britton Johnson <[email protected]>wrote:

> Thank you for the quick response!
>
> I actually am setting the NetworkCredential in my code to use the user name
> and password as it is entered into my configuration screen.  I'm confident
> in the implementation of this as it works in every environment I've tested
> it in except for this one client (good passwords/users work, bad ones
> don't).
>
> The confusion I think is in the term proxy.  I'm not referring to the
> generated web service proxy code that is generated by visual studio when I
> create a web reference.  I am referring to an actual HTTP web proxy on this
> client's network/firewall.  This clash in terms has made it hard to google
> for solutions so far.
>
> My question can probably be summed up as does the SoapHttpClientProtocol
> class know to check for a WebProxy if the local machine has one configured?
> Do I need to implement my own configuration for WebProxy detection or is
> this handled by the .net framework intrinsically?  I've seen a few examples
> of creating WebProxy objects and assigning them to the
> SoapHttpClientProtocol.Proxy property of my service, but the hover text in
> VS tells me this deprecated and I should use the default proxy provided
> (null in my case).
>
> Thank you very much!
>
>
>
> On Tue, Nov 10, 2009 at 2:38 AM, Raghupathi Kamuni 
> <[email protected]>wrote:
>
>> By default, the Web service client proxy does not inherit the credentials
>> of the security context where the Web service client application is running.
>>
>> To resolve this problem, you must use the Credentials property of the Web
>> service client proxy to set the security credentials for Web service client
>> authentication.
>> Look in here for resolution details
>> http://support.microsoft.com/kb/811318
>>
>>   On Tue, Nov 10, 2009 at 4:17 AM, Britt <[email protected]> wrote:
>>
>>>
>>> I have a windows application that connects to a web service that we've
>>> just rolled out to a new client.  The application is throwing a 401
>>> access denied error when the application is trying to connect to the
>>> web service.
>>>
>>> Some things I've tried:
>>>
>>> I tested that the user ID and password are correct by installing the
>>> application on a few of our home computers.  All of them succeed with
>>> the right credentials entered and fail properly with bad login
>>> information (straight up home installs with no VPNs or anything).
>>>
>>> I have verified the login and password are entered correctly by the
>>> client (I had the app dump the text for me to verify).
>>>
>>> I have verified that the client can point IE to the web service's URL,
>>> which properly authenticates with the login and password.
>>>
>>> I wouldn't necessarily think that a 401 error would result from this,
>>> but I did notice that their browsers have proxy autodetect turned
>>> on.
>>>
>>> I did some research to see if that was something I would have to
>>> implement.  When I looked at assigning a proxy object to the Proxy
>>> property of the web service generated code, I get a deprecated message
>>> that says I should just use the proxy object that is automatically
>>> provided.  Does that mean that the framework and the generated web
>>> service wrapper code from Visual Studio is smart enough to query the
>>> registry and detect web proxies?
>>>
>>> I created a form to dump out some of the settings as they exist on
>>> that machine and it appears that the Proxy property of the web service
>>> instance is null.
>>>
>>> Does anyone think the proxy is my problem, or should I keep looking?
>>> If it is the proxy, should the framework handle this out of the box or
>>> is this custom implementation?
>>> Is it possible that the proxy is stripping my credentials from the
>>> soap request and is there an obvious difference between my app
>>> creating an authenticated connection to the web service URL and the
>>> client's web browser making an authenticated (challenge/response)
>>> connection to the exact same URL?
>>>
>>> Thank you all!
>>>
>>
>>
>

Reply via email to