[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


WebReference not working through proxy server http error 407 User is not authenticated

Posted on 2008-11-03
Medium Priority
Last Modified: 2012-05-05
I have been working on this for some time now and done some research into it.

My app uses a .asmx web service located on our server. The app has a webreference built into it that is used to consume the web service.

It works like a charm unless the end user is behind a proxy server. I am sure I need to set up some type of user authentication but can not figure out where to start.

                Dim proxy As New StrucWebReference.strucWebService
                proxy.Credentials = CredentialCache.DefaultCredentials

                    If proxy.TestWebService = True Then
                        hasWebService = True
                        Me.ListBox.SelectedIndex = Me.ListBox.Items.Add("Web Service Available")
                        Me.ListBox.SelectedIndex = Me.ListBox.Items.Add("Web Service Test False")
                    End If
                Catch ex As NullReferenceException

                Catch ex As System.Net.Sockets.SocketException

                Catch ex As System.Net.WebException

                Catch ex As Exception

                End Try

When i do this it throws the System.Net.Webexception http erro 407 proxy server authentication failed.

I thought the web reference would use the user's default credentials and be easy. Do I need to build some type of proxy with custom user credientials that the user inputs and then point my webreference through that!!!!!!! At wit's end any help would be greatly appreciated
Question by:wilsoada
1 Comment
LVL 96

Accepted Solution

Bob Learned earned 2000 total points
ID: 22875775
I use some obsolete code (which still works if you can ignore the warning):

        Dim proxy As System.Net.WebProxy = System.Net.WebProxy.GetDefaultProxy()
        If proxy.Address IsNot Nothing Then
        End If

Open in new window


Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When we want to run, execute or repeat a statement multiple times, a loop is necessary. This article covers the two types of loops in Python: the while loop and the for loop.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Suggested Courses
Course of the Month18 days, 22 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question