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.

348 questions
80
votes
3 answers

Cookie path and its accessibility to subfolder pages

Let 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
  • 2,647
  • 5
  • 25
  • 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
  • 17,572
  • 9
  • 34
  • 76
42
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,008
  • 6
  • 25
  • 53
29
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
  • 301
  • 1
  • 3
  • 4
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
  • 38,142
  • 26
  • 119
  • 203
23
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
  • 7,976
  • 5
  • 35
  • 41
21
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
  • 19,274
  • 22
  • 97
  • 172
20
votes
2 answers

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

Semicolon ;, the Cookie: string or some other string?
lovespring
  • 17,187
  • 39
  • 95
  • 145
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,348
  • 4
  • 22
  • 44
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
  • 525
  • 2
  • 5
  • 7
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
  • 82,194
  • 38
  • 141
  • 186
15
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
  • 2,903
  • 7
  • 29
  • 39
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,221
  • 9
  • 40
  • 69
9
votes
0 answers

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
  • 11,376
  • 8
  • 74
  • 105
9
votes
2 answers

AWS Application Load Balancer : Request Header Or Cookie Too Large

AWS's new Application Load Balancer is throwing an error : 400 Bad Request, Request Header Or Cookie Too Large, awselb/2.0 How do i increase the size in aws-elb. It was working fine with the classic load balancer.
Kechit Goyal
  • 3,002
  • 2
  • 16
  • 19
1
2 3
23 24