HttpCookie currentUserCookie = HttpContext.Current.Request.Cookies["currentUser"];
HttpContext.Current.Response.Cookies.Remove("currentUser");
currentUserCookie.Expires = DateTime.Now.AddDays(-10);
currentUserCookie.Value = null;
HttpContext.Current.Response.SetCookie(currentUserCookie);
It works.
Related Contents:
- Automatic Cookie Handling C#/.NET HttpWebRequest+HttpWebResponse
- Could not find a part of the path … bin\roslyn\csc.exe
- Calculate the execution time of a method
- Which .NET Dependency Injection frameworks are worth looking into? [closed]
- Creating a DateTime in a specific Time Zone in c#
- Setting Objects to Null/Nothing after use in .NET
- One class per file rule in .NET? [closed]
- Show a Form without stealing focus?
- Where can I find a NuGet package for upgrading to System.Web.Http v5.0.0.0?
- How can I catch a 404?
- Reading a C/C++ data structure in C# from a byte array
- Find image format using Bitmap object in C#
- Casting: (NewType) vs. Object as NewType [duplicate]
- How to set time to midnight for current day?
- Compiling C# to Native?
- How do you display a custom UserControl as a dialog?
- Return in catch block?
- .NET – WindowStyle = hidden vs. CreateNoWindow = true?
- WinForms Applications: Where is console.writeline() output rendered?
- Can I specify my explicit type comparator inline?
- Does .Disposing a StreamWriter close the underlying stream?
- Encoding parameters for a URL
- Error “Elements defined in a namespace cannot be explicitly declared as private, protected, or protected internal”
- What operations are atomic in C#?
- Controlling Volume Mixer
- What is the correct way to compare char ignoring case?
- How to make a simple dynamic proxy in C#
- Can I LINQ a JSON?
- How do you clear cookies using asp.net mvc 3 and c#?
- How can I change a .NET standard library to a .NET framework library?
- Reverse Sorted Dictionary in .NET
- Is there a way to convert a System.IO.Stream to a Windows.Storage.Streams.IRandomAccessStream?
- Why does C# execute Math.Sqrt() more slowly than VB.NET?
- What are the differences between the XmlSerializer and BinaryFormatter
- Reading file content to string in .Net Compact Framework
- Exporting a Certificate as BASE-64 encoded .cer
- What’s the point of overriding Dispose(bool disposing) in .NET?
- C#: event with explicity add/remove != typical event?
- Apply a Regex on Stream?
- How to load assemblies located in a folder in .NET Core console app
- How can I create an Action delegate from MethodInfo?
- Generate Random Boolean Probability
- When to change the Generate Serialization Assembly value?
- How to prevent XXE attack (XmlDocument in .NET)
- Remove readonly attribute from directory
- Getting list of names of Azure blob files in a container?
- ASP.NET Core 2.0 combining Cookies and Bearer Authorization for the same endpoint
- Filter/Search using Multiple Fields – ASP.NET MVC
- Get thumbnail image of video file in C# [closed]
- Embedding assemblies inside another assembly