Expiring an IE session using WatiN

Posted by Steve Wilkes on Stack Overflow See other posts from Stack Overflow or by Steve Wilkes
Published on 2011-11-30T16:21:23Z Indexed on 2011/11/30 17:51 UTC
Read the original article Hit count: 179

I'm trying to write an acceptance test using WatiN which checks that a user is redirected to the login page if they navigate to a page after their session times out. I'm using WatiN's IE class for the browser, and trying the following:

// 1. Login

// 2. Do this:
Browser.ClearCookies();
Browser.ClearCache();

// 3. Navigate to a different page

But the user is always still logged in. Other info:

  1. I'm running the test through the NUnit GUI running as an administrator
  2. It's an ASP.NET MVC 3 site, using forms authentication and in-process session state
  3. I'm using IE9.
  4. If I manually clear all cookies in Chrome, the user is logged out
  5. If I manually clear all cookies in IE the user stays logged in
  6. If I call Browser.Eval("alert(document.cookie)"); in IE it alerts an empty string

Given the above, I'm assuming this is a quirk with IE; any ideas how I can work around it?

© Stack Overflow or respective owner

Related posts about c#

Related posts about asp.net-mvc-3