?
Solved

Web Service Proxy Authentication

Posted on 2004-03-31
8
Medium Priority
?
915 Views
Last Modified: 2012-08-14
I am writing a windows forms client that uses a web reference.  I am trying to get my app to work through a proxy server, but I need it to use the user's domain credentials if possible.  So far it will work through the proxy, but fails to authenticate using the domain credentials of the currently logged in user.

I would imagine that I need to get them from some built-in OS source, but I can't find any references on how to do that.

-Javier
0
Comment
Question by:jmvoodoo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 6
  • 2
8 Comments
 
LVL 8

Accepted Solution

by:
nishikanth earned 2000 total points
ID: 10729972

oProxy.Credentials = New NetworkCredential(.HTTPUserName, .HTTPPassword,
.HTTPAddress)

Please enter the correct Domain Name for the account. The better approach
is to always consider CredentialCache class:
oProxy.Credentials = New NetworkCredential(.HTTPUserName, .HTTPPassword,
DomainName)
Dim cache As new CredentialCache
Cache.Add(new Uri(.HTTPAddress), "NTLM" , oProxy.Credentials )
oProxy.Credentials = cache

You can also use the default user credentials for NTLM and Negotiate
authentication:
oProxy.Credentials = CredentialCache.DefaultCredentials


http://www.fawcette.com/vsm/2002_06/online/online_eprods/aspnet_jgoodyear_06_24_02/default_pf.aspx
http://codeproject.com/vb/net/web_service_by_proxy.asp
http://support.microsoft.com/default.aspx?scid=kb;en-us;813834
http://support.microsoft.com/default.aspx?scid=kb;en-us;811318


0
 
LVL 1

Author Comment

by:jmvoodoo
ID: 10734570
I think oProxy.Credentials = CredentialCache.DefaultCredentials is what I was looking for... I will test it today and accept if it works.

Thanks!

-Javier
0
 
LVL 1

Author Comment

by:jmvoodoo
ID: 10737322
Ok, I think I'm getting close, but when I do:

myService.Proxy.Credentials = CredentialCache.DefaultCredentials

I get "reference isn't set to an instance of an object" or something along those lines (i'm sure you've seen the error before, the Proxy member isn't set).   I have my config set to usedefaultproxy, so I thought that the Proxy member would contain the default proxy info, but I guess I was mistaken.  So now the question is how to populate the Proxy member of the webservice proxy with the correct proxy info from the system's default proxy... any ideas?
0
What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 
LVL 1

Author Comment

by:jmvoodoo
ID: 10737438
I think I may have gotten it.  Using myService.Proxy = WebProxy.GetDefaultProxy, but I can't test it from here.  I'll test again tomorrow morning.
0
 
LVL 1

Author Comment

by:jmvoodoo
ID: 10743754
No dice, still getting the same 407 proxy authentication required.  I am completely baffled at this point.
0
 
LVL 1

Author Comment

by:jmvoodoo
ID: 10753144
Ok, so I did a little bit more research, and rewrote the code so I have:

Dim pr As New WebProxy("isaserver", 8080)
Dim cr As New NetworkCredential("login", "password", "domain")
pr.Credentials = cr
WebService.Proxy = pr
WebService.test()

and I'm still getting the 407 proxy authentication required.  I have checked the ISA server logs and it's recording it as anonymous as if credentials aren't even being passed by .NET, is there something else I need to do in order to actually send the credentials, other than setting the credentials method of the webproxy object?
0
 
LVL 8

Expert Comment

by:nishikanth
ID: 10754302
check out your asp.net permisisons and user login... the above one seems to be fine
0
 
LVL 1

Author Comment

by:jmvoodoo
ID: 10754697
ok, i ran a packet sniffer to figure out what was going on, and it was trying to use digest authentication.  Digest authentication was turned on on the server, so it should have worked.  However, when I forced it to use Basic using credentialcache.add() it worked like a charm.

After I got that working, I went to do a packet sniff on the original code (that uses the credentialcache.defaultcredentials) and it worked perfectly... the packet sniffer revealed that it was using Negotiate authentication.  Any idea what might cause such sporatic behavior?  I really need this to use the stored logon credentials, or I'd just stick with basic auth and leave it at that.

-Javier
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

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

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
Suggested Courses

770 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