How To Expire a Cookie How To Expire a Cookie

You want to set expiry date of cookie. Here are C# and code samples. C# Set Cookie expires.

protected void Page_Load(object sender, EventArgs e)

HttpCookie UserNameCookie = new HttpCookie("UserName");
UserNameCookie.Value = "Satalaj";



The cookie created in above example will expire in 1 day. You can also add TimeSpan, which will help you to expire the cookie in a minute or second. cookie expiry.

Protected Sub Page_Load(sender As Object, e As EventArgs)

Dim UserNameCookie As New HttpCookie("UserName")
UserNameCookie.Value = "Satalaj"


End Sub

Tags: How To Expire a How To Remove page specific Interview Questions for 2 years or 3 years 2.0 step by step Membership Provider asp net image uploadWhat is web garden in File HandlingSessions In open new windowHack


My name is Satalaj, but people call me Sat. Here is my homepage: . I live in Pune, PN and work as a Software Engineer. I'm former MVP in year 2010.
Disclaimer: Views or opinion expressed here are my personal research and it has nothing to do with my employer. You are free to use the code, ideas/hints in your projects. However, you should not copy and paste my original content to other web sites. Feel free to copy or extend the code.
If you want to fight with me, this website is not for you.

I'm Satalaj.