It seems like a very simple question, but after a couple of hours of research in here and on the web, I'm starting to think I'm perhaps asking the wrong questions or doing something wrong.
In any case, I have a web service that is used for logging-in, once successful, a header cookie is returned, and subsequent calls to other services using this cookie will be considered as authenticated. It may not be the safest or best practice, but this is the service I have
In Java, I’m simply taking the cookie from the response of the successful login and pass to other calls
e.g. (I know, some calls are deprecated, and Axis 1 is deprecated altogether, but use your imagination)
// get the cookie
Call authCall = service1Locator.getCall();
org.apache.axis.MessageContext msgContext = authCall.getMessageContext();
String cookie = msgContext.getStrProp(HTTPConstants.HEADER_COOKIE);
// Standard binding
Service2Locator service2Locator=new Service2Locator();
Service2SoapBindingStub service2=(Service2SoapBindingStub)service2Locator.getSomeService();
service2Locator.setMaintainSession(true);
// And now - SET THE COOKIE
service2._setProperty(HTTPConstants.HEADER_COOKIE,cookie);
(original example from here)
As far as it may be old, incorrect or insecure (is it?), I would like to still do the same thing in .NET
I saw comments on CookieContainer, but my service (auto generated by VS Express 2010) doesn't have such a property...
What is the equivalent way to get a cookie from one service call and pass to the other (to emulate some session persistence as a browser would do automatically)
(I still want to use the simple "add service reference" auto generated web .NET service client if possible)
This seems like a good answer
http://jonas.follesoe.no/2008/09/12/wcf-authentication-services-silverlight-and-smelly-cookies/
Also this question which referred to it How to use authentication cookie from WCF Authentication Service in an ASP.Net MVC application