Questions tagged [httpcookiecollection]
10 questions
24
votes
1 answer
HttpCookieCollection.Add vs HttpCookieCollection.Set - Does the Request.Cookies collection get copied to the Response.Cookies collection?
I just want to clear this up.
I know that if I have set a cookie on a previous request, it will show up in my Request.Cookies collection.
I want to update my existing Cookie.
Are the cookies from my Request.Cookies collection already copied to…

smartcaveman
- 41,281
- 29
- 127
- 212
9
votes
1 answer
Deserialize a json serialized CookieCollection
In my code I have to Json serialize a CookieCollection object and pass it as string, to achieve this I do like this:
var json = Newtonsoft.Json.JsonConvert.SerializeObject(resp.Cookies);
resulting to the following json
[
{
"Comment": "",
…

HadiRj
- 1,015
- 3
- 21
- 41
8
votes
1 answer
Why does HttpCookieCollection.Get returns null when called from a manually instantiated object (and not from the current HttpContext)
In the HttpCookieCollection.Get MSDN documentation, it is stated that:
If the named cookie does not exist, this method creates a new cookie
with that name.
This is true and works well when calling HttpContext.Request.Cookies or…

Vincent de Lagabbe
- 4,964
- 3
- 31
- 38
1
vote
1 answer
RestSharp 109: Adding cookies to every request
In RestSharp 108 and below the RestClient could add common cookies to every call like this:
RestClient.CookieContainer.Add(new Cookie("hello", "hello", "/", _baseUrl.Host));
This is no longer the case in RestSharp 109. How can we add a seriers of…

Ian Vink
- 66,960
- 104
- 341
- 555
1
vote
1 answer
What is the best practice for updating a cookie that was set on a previous request in ASP.NET?
Here is the scenario. A cookie with the key "MyCookie" has been set on a previous request. I can access it via HttpContext.Request.Cookies.Get("MyCookie"). I want to perform an update such as adding another value to the Cookie Values collection,…

smartcaveman
- 41,281
- 29
- 127
- 212
0
votes
0 answers
Cookie sent in rediret response are getting ifnored
In login implementation, backend API is redirecting user home page along with setting the session cookie. But when Browser invokes redirect request to home page, this cookie is not getting set-
Request URL:…

Abhijeet srivastava
- 449
- 7
- 16
0
votes
1 answer
How can I update a request CookieCollection after after removing/deleting a cookie object from the collection in CakePHP
I am having problems working with request cookies on my project. I have a cookie collection with about 3 values a, b, and c.
Then I try the following for instance:
$cookieCollection = $this->getRequest()->getCookieCollection();
if…

I_am_NHO
- 27
- 1
- 8
0
votes
1 answer
C# HttpWebRequest Use cookie
I have a little problem with cookie handling in C#
So on my web site, I have a login page, once logged in, I am redirected to the home page. I get with HttpWebRequest to connect and follow the redirection, I created a class, here it is :
class…

Y.op
- 79
- 1
- 1
- 9
0
votes
0 answers
I only seem to be able to set one Cookie - HttpCookie, asp.net
I have a system with a two-stage login.
Stage one is a Company Login which identifies the Company using my system.
Stage two is a Staff Login where a member of staff belonging to the above company logs in.
In both stage an option is offered to save…

Jamie Hartnoll
- 7,231
- 13
- 58
- 97
0
votes
1 answer
Sharepoint 2010 setting a cookie expiration date seemsto work when viewed from browser but server code sees 01/01/0001 expiration
here is the to add the cookie to the request
HttpCookie cookie = new HttpCookie(myCookie);
cookie.Expires = DateTime.Now.AddDays(30);
cookie.Value = myValue;
cookie.Domain = myDomain;
cookie.HttpOnly = true;
…

Anthony
- 536
- 1
- 8
- 27