.NET Core WCF Web Service with Cookies

Cris 21 Reputation points
2022-03-31T17:21:49.4+00:00

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.

.NET
.NET
Microsoft Technologies based on the .NET software framework.
3,388 questions
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,177 questions
{count} votes

3 answers

Sort by: Most helpful
  1. Cris 21 Reputation points
    2022-03-31T19:37:48.89+00:00

    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

    0 comments No comments

  2. Bruce (SqlWork.com) 56,526 Reputation points
    2022-03-31T22:13:40.44+00:00

    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:

    https://stackoverflow.com/questions/59257689/asp-net-core-making-soap-api-request-with-wcf-client-how-to-add-a-cookie-header


  3. Cris 21 Reputation points
    2022-04-06T19:37:56.367+00:00

    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

    0 comments No comments