2

I have an umbraco site and am using integrated windows authentication for the public site. All works ok in IE, Firefox, Safari. However, in goolgle chrome, the user keeps getting sent back to the logon page. Sometimes it works ok, others not. The code that logs the user in is listed below:

//some stuff to get the member name from the windows username, then:
FormsAuthentication.SetAuthCookie(username, true);

    Member loginMember = Member.GetMemberFromLoginName(username);
    if (loginMember != null)
    {
        Member.AddMemberToCache(loginMember, true, new TimeSpan(0, 20, 0));
    }
    FormsAuthentication.RedirectFromLoginPage(username, true);

As mentioned, this works ok in any browser other than chrome.. any ideas?

Dave Stringer
  • 349
  • 4
  • 15
  • Any chance you have chrome set to not accept cookies or are using some other addin that might be getting in the way? – E.J. Brennan Mar 28 '13 at 23:27

1 Answers1

0

Are you checking that the member is a valid one before redirecting?

if (Membership.ValidateUser(username, password))
{
FormsAuthentication.SetAuthCookie(username, true);
// rest of your code here
}

If this doesn't work, then without seeing more code, I feel there is not enough information to answer correctly why you are being logged out. If you really believe it is just Chrome, then please try 1) using chrome in incognito mode (ctrl+shift+N), and 2) reinstalling chrome. There is a chance that a plugin could be interfering with your cookie storage.

Finally, if the issue persists after reinstalling Chrome, then please take a look at the following code:

http://our.umbraco.org/projects/website-utilities/razorlogin

Good luck, and please let us know if it works.

csharpforevermore
  • 1,472
  • 15
  • 27