0

Im experiencing a weird issue between two machines. Both machines are Window 7 SP1 with Internet Explorer 11. I am using MVC4 with Visual Studio 2013 and Selenium Web Driver to do my Web UI tests.

When running my UI test's are the start each test must login to the system. Within my controller code I have a method that uses the code below:

private const string CurrentUserSessionKey = "CurrentUser";
private ICache _cache;

public virtual User User
{
    get
    {
        User invokingUser = null;
        if (HttpContext.Current.Session[CurrentUserSessionKey] != null)
        {
            invokingUser = HttpContext.Current.Session[CurrentUserSessionKey] as User;
        }
        return invokingUser;
    }
    set
    {
        HttpContext.Current.Session[CurrentUserSessionKey] = value;
    }
}

The strange is you issue that it works within by development environment but not by test environment.

Within my development environment it log's the user in fine. Within my production environment HttpContext.Current.Session always seems to be null when posting to the login controller.

Uwe Keim
  • 39,551
  • 56
  • 175
  • 291
Lemex
  • 3,772
  • 14
  • 53
  • 87

1 Answers1

0

Within my test machines i have to use

<sessionState mode="InProc" timeout="20" cookieless="AutoDetect" />
Look here for more info on the SessionState directive.

To allow the tests to run

Lemex
  • 3,772
  • 14
  • 53
  • 87