Error Object reference not set to instance of object when passing cookie to API

48 Views Asked by At

I am attempting to pass a cookie to an API to consume one of its services. However, it comes up with this error, so matter how I attempt to do so. Here is the line of code where this occurs:

_service.CookieContainer.Add(new Cookie("ASP.NET_SessionId", sessionID) { Domain = "webservices.24sevenoffice.com" });

Does anyone know how to resolve this issue? SessionID is NOT null, and the other values are explicitly given so it's quite confusing.

0

There are 0 best solutions below