Passing credentials problem

P

porter_wss

I am at a loss. I have a web service which uses Windows Integrated
Security.

If I use the following code to call my web service:

WServ wserv = new WServ();
wserv.Credentials = System.Net.CredentialCache.DefaultCredentials;
WServDS wservds = wserv.GetWServDS();

My web service works fine.

However, when I change to this:

WServ wserv = new WServ();

CredentialCache cc = new CredentialCache();
NetworkCredential nwc = new NetworkCredential("User", "Pass",
"Domain");

cc.Add(new System.Uri(wserv.Url), "Negotiate", nwc);
wserv.Credentials = cc;

WServDS wservds = wserv.GetWServDS();

I get a 401, Access Denied. I am creating the same credentials for
which I am logged in. I do not understand. I have searched all over
and seem to be doing exactly what is required. Can anyone think of
what I should check?
 
K

Keenan Newton

Personally i never had luck using new Credential cache. I always ended
up setting a credential cache equal to the default cache. So you would
have this:

CredentialCache cc = System.Net.CredentialCache.DefaultCredentials;

and then adding my new crediential to it. I used this when dealing
with Kerberos authentication, and I had a web service proxy factory
that i wanted to use default user credentials, when I did not want to
use imperonsation. Not sure this helps any but i thought i would share
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top