Questions tagged [httpcookie]

A class in the System.Web namespace of the .NET framework which provides a type-safe way to create and manipulate individual HTTP cookies.

A class in the System.Web namespace of the .NET framework which provides a type-safe way to create and manipulate individual HTTP cookies.

409 questions
97
votes
4 answers

Cookie path and its accessibility to subfolder pages

Let's say I have a website with domain: www.example.com If I set a cookie with path '***/***' the cookie will be accessible via all pages in the domain,…
Nordin
  • 3,087
  • 5
  • 28
  • 35
48
votes
3 answers

Using Cookie in Asp.Net Mvc 4

I have web application in Asp.Net MVC4 and I want to use cookie for user's login and logout. So my actions as follows: Login Action [HttpPost] public ActionResult Login(string username, string pass) { if (ModelState.IsValid) …
Elvin Mammadov
  • 25,329
  • 11
  • 40
  • 82
46
votes
2 answers

what is the default expiration time of a cookie

By default what will be the expiration time of a cookie added using C# code? HttpCookie myCookie= new HttpCookie("myCookie"); myCookie.Value = txtCookie.Text; // Add the cookie. Response.Cookies.Add(myCookie);
Sudha
  • 2,078
  • 6
  • 28
  • 53
39
votes
5 answers

How do you update a cookie in PHP?

If I call setcookie() two times with the same cookie name, I get two cookies created. How do you update an existing cookie?
Cookie
  • 401
  • 1
  • 4
  • 4
26
votes
3 answers

Why does Request.Cookies return string instead of HttpCookie object in foreach loop?

This morning I accidentally saw the following snippet code, I was fairly surprised because it work very well. Don't look at its logic please, I'm just curious why does the HttpCookieCollection (Request.Cookies in this case) return a string (cookie…
Tien Do
  • 10,319
  • 6
  • 41
  • 42
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
20
votes
2 answers

Setcookie syntax Google Chrome

I am using following syntax to set cookie: Set-Cookie:Cookie-name=value; path=/; Max-Age=1296000; HttpOnly In google chrome console it is showing Invalid Date for that cookie. What is wrong in the syntax ? According to…
Vivek Goel
  • 22,942
  • 29
  • 114
  • 186
20
votes
2 answers

In HTTP specification, what is the string that separates cookies?

Semicolon ;, the Cookie: string or some other string?
lovespring
  • 19,051
  • 42
  • 103
  • 153
19
votes
2 answers

A cookie without a domain?

Is it possible to set a cookie without a domain? This will mean all domains will have access to it.
jamjam
  • 3,171
  • 7
  • 34
  • 39
19
votes
3 answers

ASP.NET MVC Cookie Implementation

I try to implement a basic cookie helper in my application. Mainly I check in base controller everytime whether or not if cookie is set. If cookie public class MyCookie { public static string CookieName {get;set;} public virtual User User…
gandil
  • 5,398
  • 5
  • 24
  • 46
19
votes
1 answer

The difference between HttpCookie and Cookie?

So I'm confused as msdn and other tutorials tell me to use HttpCookies to add cookies via Response.Cookies.Add(cookie). But that's the problem. Response.Cookies.Add only accepts Cookies and not HttpCookies and I get this error: cannot convert from…
Gio
  • 555
  • 2
  • 5
  • 7
17
votes
2 answers

The 'sameSite' attribute is not allowed in web.config Asp.net Web project with framework 4.8

I been trying to add sameSite = None attribute to my project cookies as a part of Chrome standards. I am using .net framework 4.8 and it supports sameSite for cookie…
16
votes
3 answers

Convert Google Analytics cookies to Local/Session Storage

UPDATE http://jsfiddle.net/musicisair/rsKtp/embedded/result/ Google Analytics sets 4 cookies that will be sent with all requests to that domain (and ofset its subdomains). From what I can tell no server actually uses them directly; they're only…
David Murdoch
  • 87,823
  • 39
  • 148
  • 191
12
votes
1 answer

Manually renew forms authentication ticket:

Yet another problem with forms authentication ticket expiring too soon. I need to use sliding Expiration set to true. I have read forums and understood the problem with the loss of precision, that the ticket only gets updated if the request is made…
Amc_rtty
  • 3,662
  • 11
  • 48
  • 73
11
votes
1 answer

Angular withCredentials is not sending cookies

I am using Angular 8, with old backend (ASP.NET MVC 5 Framework) NOT CORE I am trying to send the cookies of the website so the request from the angular website considered authenticated I created an interceptor for this import { HttpInterceptor,…
Hakan Fıstık
  • 16,800
  • 14
  • 110
  • 131
1
2 3
27 28