L
Liviu Olaru
Hi
I'm trying to invoke a Web Service which is using BASIC authentication.
Code for invoking:
CredentialCache cc = new CredentialCache();
//the network credential used to authenticate client
NetworkCredential networkCred = new NetworkCredential("USERNAME",
"PASSWORD");
// the web service proxy
WSProxy wsProxy = new WSProxy();
//Add the network credential to the cache
cc.Add(new Uri(wsProxy.Url), "Basic", networkCred);
//Set the proxy credentials
wsProxy.Credentials = cc;
//call a method on proxy
wsProxy.HellloWorld();
I WANT TO USE THE SAME URL WITH DIFFERENT CREDENTIALS.( OR WITH NO
CREDENTIAL )
//so, now I try to remove the credential from cache
cc.Remove(new Uri(wsProxy.Url), "Basic")
If I remove the credential from CredentialCache, the subsequent calls to
the web service will use the same credentials as for the first call, even
the CredentialCache is empty !
so, when I call
WSProxy wsProxy2 = new WSProxy();
wsProxy.Credentials = cc; // THIS LINE HAS NO EFFECT ! CAN BE COMMENTED
OUT !
wsProxy2.HelloWorld();
the client is autenticated with the old credentials. (I wanted to get
AccesDenied)
It seems that, for the first call, the SoapHttpClientProtocol.Invoke
method, in the case of a successful request, copies the credentials from
CredentialCache and store them, per URL basis, in a internal store that is
used for subsequent calls, even the new proxys have been setted different
credentials.
Thanks
I'm trying to invoke a Web Service which is using BASIC authentication.
Code for invoking:
CredentialCache cc = new CredentialCache();
//the network credential used to authenticate client
NetworkCredential networkCred = new NetworkCredential("USERNAME",
"PASSWORD");
// the web service proxy
WSProxy wsProxy = new WSProxy();
//Add the network credential to the cache
cc.Add(new Uri(wsProxy.Url), "Basic", networkCred);
//Set the proxy credentials
wsProxy.Credentials = cc;
//call a method on proxy
wsProxy.HellloWorld();
I WANT TO USE THE SAME URL WITH DIFFERENT CREDENTIALS.( OR WITH NO
CREDENTIAL )
//so, now I try to remove the credential from cache
cc.Remove(new Uri(wsProxy.Url), "Basic")
If I remove the credential from CredentialCache, the subsequent calls to
the web service will use the same credentials as for the first call, even
the CredentialCache is empty !
so, when I call
WSProxy wsProxy2 = new WSProxy();
wsProxy.Credentials = cc; // THIS LINE HAS NO EFFECT ! CAN BE COMMENTED
OUT !
wsProxy2.HelloWorld();
the client is autenticated with the old credentials. (I wanted to get
AccesDenied)
It seems that, for the first call, the SoapHttpClientProtocol.Invoke
method, in the case of a successful request, copies the credentials from
CredentialCache and store them, per URL basis, in a internal store that is
used for subsequent calls, even the new proxys have been setted different
credentials.
Thanks