我尝试从C#访问第三方WCF服务。它具有一个登录方法,该方法仅返回true或false作为结果,但是如果登录成功,它将返回一个cookie(使用“ Set-Cookie”标头)。
如何获取Cookie?我发现无法访问完整回复。我可以附加处理程序吗?消息拦截器仅显示消息,不显示标题。
到目前为止的代码:
var binding = new System.ServiceModel.NetHttpBinding(System.ServiceModel.BasicHttpSecurityMode.Transport);
var address = new System.ServiceModel.EndpointAddress("https://host.com/service/webservice.svc");
var svc = new WebSvc.ServiceHostClient(binding, address);
var res = svc.Login("username", Base64Encode("secret"));
res
是否成功登录=>如何从响应中获取cookie?