I have a ASP 3.5 web forms app using windows authentication that needs to call a soap based web service (the SSRS 2005 report service) which uses integrated windows authentication. However the call to the web service from the asp backend keeps throwing a 401 error. If I turn on anonymous authenticatoin on the web service it works ok using the IUSR_xxx account however I want it to connect using the windows account of the user accessing the asp web app. How can I pass through the windows user credentials?
+3
A:
Hi,
you have to authenticate your webservice by supplying the default credential to your proxy. like this
localhost.ServiceX myProxy = new localhost.ServiceX();
myProxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
cheers
Ramesh vel
Ramesh Vel
2009-09-15 07:50:44
yeah tried that but it the same 401 error is returned, the DefaultCredentials doesn't seem to contain the credentials of the current windows user
Chris Herring
2009-09-15 23:36:27
Ok that worked however I also needed to explicitly set the ImpersonationLevel property on the web service proxy WebRequest object to Impersonation. By default it was set to Delegation.
Chris Herring
2009-09-16 01:22:11
You can also use: myProxy.UseDefaultCredentials = True
davidsleeps
2009-09-28 00:01:36