Groups | Blog | Home
all groups > dotnet web services > may 2008 >

dotnet web services : PreAuthenticate = True - having no effect...


Marc J. Cawood
5/20/2008 9:03:55 AM
We're calling a Web Service from a VB.NET application (written with
VS2005) but no authentication headers are being sent even with
PreAuthenticate = True.
EOS.PreAuthenticate = True
EOS.Credentials = New System.Net.NetworkCredential("user1",
"xxxxxxx")

We've examined the request headers with Fiddler and no headers are
present. We were under the impression that PreAuthenticate forced
authentication:
http://msdn.microsoft.com/en-us/library/system.net.webrequest.preauthenticate.aspx

The only special aspect of our web service is that the server does not
actually challenge for authentication and we can't influence this
(authentication is optional). How can we "force" the Authorization:
Basic... header to be sent?

When we manually construct the same request and add the authentication
header everything works as desired:
Marc J. Cawood
5/22/2008 1:45:01 PM
OK, it seems that's just the way PreAuthenticate works. It waits for a
401, then sends credentials and from then on automatically sends
credentials on subsequent requests.

In order to force authentication you need to open the Reference.vb
file, override the GetWebRequest method and manually add the basic
AddThis Social Bookmark Button