StevieB
StevieB

Reputation: 6533

ASP.NET is HttpCookie a persistent or session type of cookie

I.e. the following cookie

        HttpCookie cookie = Request.Cookies["Cookie"];

is HttpCookie a persistent or session type of cookie

Upvotes: 0

Views: 584

Answers (2)

TimDog
TimDog

Reputation: 8928

It will only persist on the client if you attach an expires attribute. Otherwise, cookies without an expires attribute will be treated as session cookies and removed when the browser session ends.

Upvotes: 1

coder
coder

Reputation: 13248

Session cookies

These are temporary cookie files, which are erased when you close your browser. When you restart your browser and go back to the site that created the cookie, the website will not recognize you. You will have to log back in (if login is required) or select your preferences/themes again if the site uses these features. A new session cookie will be generated, which will store your browsing information and will be active until you leave the site and close your browser.

Persistent cookies

These files stay in one of your browser's subfolders until you delete them manually or your browser deletes them based on the duration period contained within the persistent cookie's file.

Upvotes: 0

Related Questions