Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6110211
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:29:23+00:00 2026-05-23T14:29:23+00:00

var req = (HttpWebRequest)HttpWebRequest.Create(http://mydomain.com/myservice); var resp = (HttpWebResponse)req.GetResponse(); var cookies = resp.Cookies; Console.WriteLine(Cookie count:

  • 0
var req = (HttpWebRequest)HttpWebRequest.Create("http://mydomain.com/myservice");
var resp = (HttpWebResponse)req.GetResponse();
var cookies = resp.Cookies;
Console.WriteLine("Cookie count: {0}", cookies.Count);

Output is:

Cookie count: 0

I can see using Charles that the call to my web service is returning cookies. Why don’t they show up in my response’s cookie collection?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T14:29:24+00:00Added an answer on May 23, 2026 at 2:29 pm

    Try creating a CookieContainer in your request object to accomodate the cookies:

    var req = (HttpWebRequest)HttpWebRequest.Create("http://mydomain.com/myservice");
    req.CookieContainer = new CookieContainer();
    var resp = (HttpWebResponse)req.GetResponse();
    var cookies = resp.Cookies;
    Console.WriteLine("Cookie count: {0}", cookies.Count);
    

    From the Remarks section of the documentation for the CookieContainer property:

    CookieContainer is null by default.
    You must assign a CookieContainer
    object to the property to have cookies
    returned in the Cookies property of
    the HttpWebResponse returned by the
    GetResponse method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following two observables System.Net.WebRequest req = System.Net.HttpWebRequest.Create(http://test.com/data.xml); req.Method = HEAD; var
I have the following code var postData = ; var req = HttpWebRequest.Create(http://www.imageshack.us/upload_api.php); req.ContentType
Quite simple really: var req:URLRequest=new URLRequest(); req.url=http://somesite.com; var header:URLRequestHeader=new URLRequestHeader(my-bespoke-header,1); req.requestHeaders.push(header); req.method=URLRequestMethod.GET; stream.load(req); Yet,
I am trying to do the following: from client var req = jQuery.post( http://www.example.com:3000+/dologin,
var http = require('http'); http.createServer(function (req, res) { if (req.url == '/') { req.url
var query1 = urlencode($('input[name=searchTerm]').val()); //user1 $.getJSON('http://twitter.com/friends/ids.json?screen_name='+ query1 +'&jsoncallback=?', function(data){ $('content').append(''+data.length+''); }); This is a
my code: var req = new XMLHttpRequest(); req.open(GET,http://http://surfkid.redio.de/link.php); req.send(null); var textout = var.responseText; document.write(textout);
List<string> urls = this.populateRequestList(); this.Logger(Starting); var reqs = urls.Select<string, WebRequest>(HttpWebRequest.Create).ToArray(); var iars = reqs.Select(req
In official doc , there is some sample code: var req = http.request(options, function(res)
In my app I have the following: client.on('test', function(req, fn) { var returnArr =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.