Hi I have an app that calls a webservice and its been added as a reference but it needs to send the cookie information to be able to access the methods. Does anyone know how to do that? Thanks.
Hi I have an app that calls a webservice and its been added as a reference but it needs to send the cookie information to be able to access the methods. Does anyone know how to do that? Thanks.
Cookies are an HTTP header.
https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cookie
The client app must add the cookie to the HTTP header when sending the request. What are you using to send the request?
By the way, it is far more common to send a bearer token.
HI I am using HttpWebRequest. When adding reference in .NET framework it has System.Web.Services.Protocols with the CookieContainer. But .NET Core 3.1 doesnt. So how do I attach a Cookie before sending it to the service url?
I need to pass a session cookie to the web service before it allows me to use the method
using (WebServiceClient webservice = new WebServiceClient(WebServiceClient.EndpointConfiguration.WSHttpBinding_IWebService))
{
GetRequest inReq = new GetRequest();
GetResponse outRes = new GetResponse();
inReq.Test1 = true;
inReq.Test2 = true;
outRes = webservice.GetContext(inReq); .....
how do I insert Cookie? Thanks
you first need to read the cookie. from the server. you need a server url that will create and return the cookie. you then save the cookie and use in later calls.
passing the cookie is a little tricky:
am actually getting a different error now
The communication object, System.ServiceModel.ChannelFatory'1[IWebService], cannot be used for communication because it is in the Faulted state.
The error can indicate the client is not properly handling the WCF connection when a fault is received. There are many possibilities for the what is causing the fault. You'll need to troubleshoot.
Turn on WCF tracing on the client and server.
Then compare logs. Capture a good request/response so you know what good request/response looks like. You can also use a network trace tool or a proxy to capture the actual HTTP message. You'll want to make sure the HTTP request is formatted properly. Again, it is helpful if you have a good HTTP request for comparison.
I am still getting errors intermittently
service is unavailable This could be because the service is too busy or because no endpoint was found listening at the specified address...
I think it could be because of maxConcurrentSessions or maxConcurrentInstances
Anyone know how to set this in appsettings.json? Thanks I appreciate it
1 Person is following this question.