HttpResponse.AppendCookie Method
.NET Framework 4
This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.
Adds an HTTP cookie to the intrinsic cookie collection.
Assembly: System.Web (in System.Web.dll)
Parameters
- cookie
- Type: System.Web.HttpCookie
The HttpCookie to add to the output stream.
| Exception | Condition |
|---|---|
| HttpException |
A cookie is appended after the HTTP headers have been sent. |
Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2
The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Oversized cookies not throwing error
I have an application that (upon successful login) writes out a cookie with user information followed by a RedirectFromLoginPage().
Recently, I ran into a situation where the cookie size exceded 4K. However, no error was thrown when I created the cookie, appended the cookie to the response headers.
And, since the RedirectFromLoginPage through no errors, it was extremely difficult to track down the problem. It seems to me that AppendCookie should throw an error if a cookie excedes 4K.
Recently, I ran into a situation where the cookie size exceded 4K. However, no error was thrown when I created the cookie, appended the cookie to the response headers.
And, since the RedirectFromLoginPage through no errors, it was extremely difficult to track down the problem. It seems to me that AppendCookie should throw an error if a cookie excedes 4K.
- 2/11/2011
- TadRichard