Jim Kiely
Jim Kiely

Reputation: 385

Call web service and passing a cookie in an ASP.Net Web Application

We have to call a web service hosted by our client. We were able to add a web reference to our ASP.Net web application and use the web service. The client just sent us a text file and said we need to pass this as a cookie to get access to the web service. I ask for their help and they sent me this.

SoapHttpClientProtocol clientProxy = new T();
clientProxy.CookieContainer.Add(uri, cookie);

Is there a way to do this using a web reference? Or do I hav eto make a soap call?

Upvotes: 1

Views: 1730

Answers (1)

Markus
Markus

Reputation: 22501

The web reference you have generated should be derived from System.Web.Services.Protocols.SoapHttpClientProtocol (for details see this link). The ancestors of this class also provide a property named CookieContainer so that you can use the following code:

webRefInstance.CookieContainer.Add(uri, cookie);

Upvotes: 1

Related Questions