How to clear a cookie programatically?

Posted by peter on Stack Overflow See other posts from Stack Overflow or by peter
Published on 2010-05-03T22:39:51Z Indexed on 2010/05/03 22:48 UTC
Read the original article Hit count: 207

Filed under:
|
|

Hi All,

I am using silverlight unit tests to test an important part of our site. Is it possible to clear cookies before each unit test runs?

The problem is that if I do this,

HtmlPage.Document.Cookies = "";

It doesn't work. If the cookie already was this,

key = value

I can do this,

HtmlPage.Document.Cookies = "key=";

It kind of clears it out, but the string "key" is still part of the cookie.

Any ideas?

Are there any other classes in .NET that deal with cookies? The functionality seems quite limited when I am dealing with more complicated scenarios.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about c#