After Logging in Members fall off-line after two pages.
Dear Umbraco folk,
I am configuriing Membership for my new site Umbraco 7 MVC / UCommerce site and
After Members Login using my Login web page, they show as Online for the immediate next page only, but then fall offline for subsequent pages :-(
To summarize my code showing only relevant bits, this is how my Login page Logs a Member in:
// Get the Umbraco MemberService
var umbMemberService = AppHelpers.UmbServices().MemberService;
// Get the Umbraco Member
var umbracoMember = umbMemberService.GetByEmail(model.EmailAddress);
// Create and instance of the MembershipHelper
var membershipHelper = new MembershipHelper(UmbracoContext.Current);
string thisUserName = umbracoMember.Username;
if (membershipHelper.Login(thisUserName, model.Password))
{
// Do several actions for successful logon here including
FormsAuthentication.SetAuthCookie(model.EmailAddress, true);
// Note also that debugger shows FormsAuthentication.Timeout = {00:30:00} or 30 minutes
}
The Login page returns a redirect along with the following cookies in the Responce header (using IE Debug tools):
After Logging in Members fall off-line after two pages.
Dear Umbraco folk,
I am configuriing Membership for my new site Umbraco 7 MVC / UCommerce site and
After Members Login using my Login web page, they show as Online for the immediate next page only, but then fall offline for subsequent pages :-(
To summarize my code showing only relevant bits, this is how my Login page Logs a Member in:
The Login page returns a redirect along with the following cookies in the Responce header (using IE Debug tools):
I am not sure why there are TWO "yourAuthCookie"s ?? Anyway those time outs are 30 minutes in the future so that seems fine.
When the browser requests the redirect page, I see that the Request Header includes the following
But I also see that the Responce Header with that page includes the following
WHICH IS IN THE PAST !!!! which probably explains why I am then logged out when I try and visit any subsequant pages.
Any clues as to what may be causing this and/or how to fix would be greatly appreciated.
Thanks very much
Terry Clancy
ClanceZ
Hi again,
Never mind, I found the problem.
I needed to remove the following line from my code shown above:
I assume that either Umbraco or ASP.Net (probably ASP.Net) is doing that for me and it is unnecessary to do it here.
With that removed only one "yourAuthCookie" is set and everything seems to be working as expected.
Thanks
Terry Clancy
ClanceZ
is working on a reply...