Re: How to CHANGE the Credentials for a web service proxy when using CredentialCache ?

From: Jan Tielens (jan_at_no.spam.please.leadit.be)
Date: 01/21/04


Date: Wed, 21 Jan 2004 08:55:00 +0100

Try this:

    NetworkCredential networkCred = new NetworkCredential("USERNAME",
"PASSWORD");

    // the web service proxy
    WSProxy wsProxy = new WSProxy();
    wsProxy.Credentials = networkCred;
   // do stuff

    WSProxy wsProxy2 = new WSProxy();
   // do stuff

--
Greetz
Jan Tielens
________________________________
Read my weblog: http://weblogs.asp.net/jan
"Liviu Olaru" <liviu.olaru@softwaresolutions.ro> wrote in message
news:#kf5eK$3DHA.2380@TK2MSFTNGP10.phx.gbl...
> 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
>
>
>
>
>
>
>
>
>
>
>


Relevant Pages

  • Re: How to CHANGE the Credentials for a web service proxy when using CredentialCache ?
    ... > "Jan Tielens" wrote in message ... WSProxy wsProxy = new WSProxy; ... I'm trying to invoke a Web Service which is using BASIC ... I WANT TO USE THE SAME URL WITH DIFFERENT CREDENTIALS.(OR WITH NO ...
    (microsoft.public.dotnet.framework.aspnet.security)
  • Re: cached login credentials
    ... , it takes longer to investigate an attack and clean up after it than it does simply to nuke-and-pave, flatten-and-rebuild, whatever. ... then over time through precision monitoring of network ... Anything that does an interactive logon will store cached credentials, ... > domain admin account credentials), is a credential cached anywhere for> the ...
    (microsoft.public.windowsxp.security_admin)
  • Re: cached login credentials
    ... administrator accounts is a good mitigation. ... then over time through precision monitoring of network ... you have a way to limit exposure to this sort of expanded attack originating ... Anything that does an interactive logon will store cached credentials, ...
    (microsoft.public.windowsxp.security_admin)
  • Re: How do you wintrolls...
    ... the system will automatically log in with those credentials from then on. ... account credentials, exactly what files do you think he wants to access? ... When Vista asks you if a newly discovered network is 'Public' or 'Private', this is one of the things it is doing. ... I have not found any necessary functionality in the menu bar; as far as I can see the only the functions that are in the menu bar are the greybeard switch for the old-style status bar and, oddly, the 'Invert Selection' command- which strictly speaking can always by done manually. ...
    (comp.sys.mac.advocacy)
  • Re: how to add "Authorization: Basic" for a web service call
    ... There are two sets of credentials you can supply. ... Proxy property allows you to specify information about the proxy server to ... Co-author of "The .NET Developer's Guide to Directory Services Programming" ...
    (microsoft.public.dotnet.security)